@Test
    public void testJoinWindowWithWindowForDeadLock() throws InterruptedException {
        log.info("Test join window with another window for deadlock");

        SiddhiManager siddhiManager = new SiddhiManager();

        String streams = "" +
                "define stream TempStream(deviceID long, roomNo int, temp double); " +
                "define stream RegulatorStream(deviceID long, roomNo int, isOn bool); " +
                "define window TempWindow(deviceID long, roomNo int, temp double) time(1 min); " +
                "define window RegulatorWindow(deviceID long, roomNo int, isOn bool) length(1); " +
                "define window RegulatorActionWindow(deviceID long, roomNo int, action string) timeBatch(1 sec); ";

        String query = "" +
                "@info(name = 'query1') " +
                "from TempStream[temp > 30.0] " +
                "insert into TempWindow; " +
                "" +
                "@info(name = 'query2') " +
                "from RegulatorStream[isOn == false] " +
                "insert into RegulatorWindow; " +
                "" +
                "@info(name = 'query3') " +
                "from TempWindow " +
                "join RegulatorWindow " +
                "on TempWindow.roomNo == RegulatorWindow.roomNo " +
                "select RegulatorWindow.deviceID as deviceID, TempWindow.roomNo as roomNo, 'start' as action " +
                "insert into RegulatorActionWindow; " +
                "" +
                "@info(name = 'query5') " +
                "from RegulatorActionWindow join TempWindow " +
                "on TempWindow.roomNo == RegulatorActionWindow.roomNo " +
                "select RegulatorActionWindow.deviceID as deviceID, TempWindow.roomNo as roomNo, true as isOn " +
                "insert into OutputStream; ";

        SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams + query);

        siddhiAppRuntime.addCallback("OutputStream", new StreamCallback() {
            @Override
            public void receive(Event[] events) {
                EventPrinter.print(events);
                inEventCount += events.length;
            }
        });

        InputHandler tempStream = siddhiAppRuntime.getInputHandler("TempStream");
        InputHandler regulatorStream = siddhiAppRuntime.getInputHandler("RegulatorStream");

        siddhiAppRuntime.start();

        tempStream.send(new Object[]{100L, 1, 20.0});
        tempStream.send(new Object[]{100L, 2, 25.0});
        tempStream.send(new Object[]{100L, 3, 30.0});
        tempStream.send(new Object[]{100L, 4, 35.0});
        tempStream.send(new Object[]{100L, 5, 40.0});

        regulatorStream.send(new Object[]{100L, 1, false});
        regulatorStream.send(new Object[]{100L, 2, false});
        regulatorStream.send(new Object[]{100L, 3, false});
        regulatorStream.send(new Object[]{100L, 4, false});
        regulatorStream.send(new Object[]{100L, 5, false});

        Thread.sleep(1500);
        assertEquals("Number of success events", 2, inEventCount);
        siddhiAppRuntime.shutdown();
    }
Window shares locks event outside of queries. This test is to ensure that there is no
deadlock according to the implementation.

@throws InterruptedException throw exception if interrupted the input handler sender.
modules/siddhi-core/src/test/java/io/siddhi/core/window/CustomJoinWindowTestCase.java