@Override
      public void run() {
        stuckThreads.add(Thread.currentThread());

        lock1.lock();

        Thread thread2 = new Thread() {
          @Override
          public void run() {
            stuckThreads.add(Thread.currentThread());
            lock2.lock();
            try {
              lock1.tryLock(10, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
              // ignore
            }
            lock2.unlock();
          }
        };

        thread2.start();

        try {
          Thread.sleep(1000);
          lock2.tryLock(10, TimeUnit.SECONDS);
        } catch (InterruptedException ignore) {
        }

        lock1.unlock();
      }
Make sure that we can detect a deadlock between two threads that are trying to acquire a two
different syncs in the different orders.
geode-core/src/integrationTest/java/org/apache/geode/distributed/internal/deadlock/DeadlockDetectorIntegrationTest.java