diff --git a/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ClientDebugger.java b/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ClientDebugger.java index 159f4bdd5b..47701aa27b 100644 --- a/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ClientDebugger.java +++ b/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ClientDebugger.java @@ -60,6 +60,7 @@ import org.jooq.debug.console.remote.ServerDebugger.CMS_setBreakpointHitHandlerA import org.jooq.debug.console.remote.ServerDebugger.CMS_setBreakpoints; import org.jooq.debug.console.remote.ServerDebugger.CMS_setLoggingActive; import org.jooq.debug.console.remote.ServerDebugger.CMS_setLoggingStatementMatchers; +import org.jooq.debug.console.remote.messaging.CommandMessage; import org.jooq.debug.console.remote.messaging.CommunicationInterface; import org.jooq.debug.console.remote.messaging.CommunicationInterfaceFactory; @@ -95,7 +96,7 @@ public class ClientDebugger implements Debugger { } this.loggingListener = loggingListener; } - comm.asyncExec(new CMS_setLoggingActive(loggingListener != null)); + comm.asyncSend((CommandMessage) new CMS_setLoggingActive(loggingListener != null)); } @Override @@ -113,7 +114,7 @@ public class ClientDebugger implements Debugger { synchronized (LOGGING_STATEMENT_MATCHERS_LOCK) { this.loggingStatementMatchers = matchers; } - comm.asyncExec(new CMS_setLoggingStatementMatchers(matchers)); + comm.asyncSend((CommandMessage) new CMS_setLoggingStatementMatchers(matchers)); } @Override @@ -134,7 +135,7 @@ public class ClientDebugger implements Debugger { synchronized (BREAKPOINT_LOCK) { this.breakpoints = breakpoints; } - comm.asyncExec(new CMS_setBreakpoints(breakpoints)); + comm.asyncSend((CommandMessage) new CMS_setBreakpoints(breakpoints)); } @Override @@ -142,13 +143,13 @@ public class ClientDebugger implements Debugger { synchronized (BREAKPOINT_LOCK) { if(this.breakpoints == null) { this.breakpoints = new Breakpoint[] {breakpoint}; - comm.asyncExec(new CMS_addBreakpoint(breakpoint)); + comm.asyncSend((CommandMessage) new CMS_addBreakpoint(breakpoint)); return; } for(int i=0; i) new CMS_modifyBreakpoint(breakpoint)); return; } } @@ -157,7 +158,7 @@ public class ClientDebugger implements Debugger { newBreakpoints[breakpoints.length] = breakpoint; breakpoints = newBreakpoints; } - comm.asyncExec(new CMS_addBreakpoint(breakpoint)); + comm.asyncSend((CommandMessage) new CMS_addBreakpoint(breakpoint)); } @Override @@ -170,7 +171,7 @@ public class ClientDebugger implements Debugger { for (int i = 0; i < breakpoints.length; i++) { if (breakpoints[i].getID() == breakpoint.getID()) { breakpoints[i] = breakpoint; - comm.asyncExec(new CMS_modifyBreakpoint(breakpoint)); + comm.asyncSend((CommandMessage) new CMS_modifyBreakpoint(breakpoint)); return; } } @@ -194,7 +195,7 @@ public class ClientDebugger implements Debugger { System.arraycopy(breakpoints, i + 1, newBreakpoints, i, newBreakpoints.length - i); breakpoints = newBreakpoints; } - comm.asyncExec(new CMS_removeBreakpoint(breakpoint)); + comm.asyncSend((CommandMessage) new CMS_removeBreakpoint(breakpoint)); break; } } @@ -219,7 +220,7 @@ public class ClientDebugger implements Debugger { } this.breakpointHitHandler = breakpointHitHandler; } - comm.asyncExec(new CMS_setBreakpointHitHandlerActive(breakpointHitHandler != null)); + comm.asyncSend((CommandMessage) new CMS_setBreakpointHitHandlerActive(breakpointHitHandler != null)); } @Override @@ -236,7 +237,7 @@ public class ClientDebugger implements Debugger { public boolean isExecutionSupported() { synchronized (IS_EDITION_SUPPORTED_LOCK) { if(isEditionSupported == null) { - isEditionSupported = comm.syncExec(new CMS_isExecutionSupported()); + isEditionSupported = comm.syncSend(new CMS_isExecutionSupported()); } } return Boolean.TRUE.equals(isEditionSupported); diff --git a/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ClientStatementExecutor.java b/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ClientStatementExecutor.java index ab119e4e7a..cbcaf847fa 100644 --- a/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ClientStatementExecutor.java +++ b/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ClientStatementExecutor.java @@ -45,6 +45,7 @@ import org.jooq.debug.console.remote.ServerDebugger.CMS_doStatementExecutorExecu import org.jooq.debug.console.remote.ServerDebugger.CMS_getStatementExecutorTableColumnNames; import org.jooq.debug.console.remote.ServerDebugger.CMS_getStatementExecutorTableNames; import org.jooq.debug.console.remote.ServerDebugger.CMS_stopStatementExecutorExecution; +import org.jooq.debug.console.remote.messaging.CommandMessage; /** * @author Christopher Deckers @@ -62,28 +63,28 @@ public class ClientStatementExecutor implements StatementExecutor { public ClientStatementExecutor(ClientDebugger debugger, Long breakpointHitThreadID) { id = nextID.incrementAndGet(); this.debugger = debugger; - debugger.getCommunicationInterface().asyncExec(new CMS_createServerStatementExecutor(id, breakpointHitThreadID)); + debugger.getCommunicationInterface().asyncSend((CommandMessage) new CMS_createServerStatementExecutor(id, breakpointHitThreadID)); } @Override public StatementExecution execute(String sql, int maxRSRowsParsing, int retainParsedRSDataRowCountThreshold) { - return debugger.getCommunicationInterface().syncExec(new CMS_doStatementExecutorExecution(id, sql, maxRSRowsParsing, retainParsedRSDataRowCountThreshold)); + return debugger.getCommunicationInterface().syncSend(new CMS_doStatementExecutorExecution(id, sql, maxRSRowsParsing, retainParsedRSDataRowCountThreshold)); } @Override public void stopExecution() { - debugger.getCommunicationInterface().asyncExec(new CMS_stopStatementExecutorExecution(id)); + debugger.getCommunicationInterface().asyncSend((CommandMessage) new CMS_stopStatementExecutorExecution(id)); } @Override public String[] getTableNames() { - String[] tableNames = debugger.getCommunicationInterface().syncExec(new CMS_getStatementExecutorTableNames(id)); + String[] tableNames = debugger.getCommunicationInterface().syncSend(new CMS_getStatementExecutorTableNames(id)); return tableNames == null? new String[0]: tableNames; } @Override public String[] getTableColumnNames() { - String[] tableColumnNames = debugger.getCommunicationInterface().syncExec(new CMS_getStatementExecutorTableColumnNames(id)); + String[] tableColumnNames = debugger.getCommunicationInterface().syncSend(new CMS_getStatementExecutorTableColumnNames(id)); return tableColumnNames == null? new String[0]: tableColumnNames; } diff --git a/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ServerDebugger.java b/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ServerDebugger.java index db74f73dd8..057edcf079 100644 --- a/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ServerDebugger.java +++ b/jOOQ-console/src/main/java/org/jooq/debug/console/remote/ServerDebugger.java @@ -58,6 +58,7 @@ import org.jooq.debug.console.remote.ClientDebugger.CMC_logQueries; import org.jooq.debug.console.remote.ClientDebugger.CMC_logResultSet; import org.jooq.debug.console.remote.ClientDebugger.CMC_processBreakpointAfterExecutionHit; import org.jooq.debug.console.remote.ClientDebugger.CMC_processBreakpointBeforeExecutionHit; +import org.jooq.debug.console.remote.messaging.CommandMessage; import org.jooq.debug.console.remote.messaging.CommunicationInterface; /** @@ -81,11 +82,11 @@ class ServerDebugger extends LocalDebugger { setLoggingListener(new LoggingListener() { @Override public void logQueries(StatementLog statementLog) { - comm.asyncExec(new CMC_logQueries(statementLog)); + comm.asyncSend((CommandMessage) new CMC_logQueries(statementLog)); } @Override public void logResultSet(int dataId, ResultSetLog resultSetLog) { - comm.asyncExec(new CMC_logResultSet(dataId, resultSetLog)); + comm.asyncSend((CommandMessage) new CMC_logResultSet(dataId, resultSetLog)); } }); } else { @@ -112,14 +113,14 @@ class ServerDebugger extends LocalDebugger { setBreakpointHitHandler(new BreakpointHitHandler() { @Override public void processBreakpointBeforeExecutionHit(BreakpointHit hit) { - BreakpointHit modifiedBreakpointHit = comm.syncExec(new CMC_processBreakpointBeforeExecutionHit(hit)); + BreakpointHit modifiedBreakpointHit = comm.syncSend(new CMC_processBreakpointBeforeExecutionHit(hit)); if(modifiedBreakpointHit != null) { hit.setExecutionType(modifiedBreakpointHit.getExecutionType(), modifiedBreakpointHit.getSql()); } } @Override public void processBreakpointAfterExecutionHit(BreakpointHit hit) { - comm.syncExec(new CMC_processBreakpointAfterExecutionHit(hit)); + comm.syncSend(new CMC_processBreakpointAfterExecutionHit(hit)); } }); } else { diff --git a/jOOQ-console/src/main/java/org/jooq/debug/console/remote/messaging/CommunicationInterface.java b/jOOQ-console/src/main/java/org/jooq/debug/console/remote/messaging/CommunicationInterface.java index 3217b3f14e..9336e4580d 100644 --- a/jOOQ-console/src/main/java/org/jooq/debug/console/remote/messaging/CommunicationInterface.java +++ b/jOOQ-console/src/main/java/org/jooq/debug/console/remote/messaging/CommunicationInterface.java @@ -130,30 +130,13 @@ public class CommunicationInterface { return messagingInterface; } - /** - * Execute that message asynchronously with the given arguments. - */ - public void asyncExec(CommandMessage message) { - asyncSend(message); - } - - /** - * Execute that message synchronously with the given arguments and return - * the result. - * - * @return the result of the execution. - */ - public S syncExec(CommandMessage message) { - return syncSend(message); - } - /** * Send that message synchronously, potentially returning a result if the * message type allows that. * * @return the result if any. */ - final S syncSend(final Message message) { + public final S syncSend(final Message message) { checkOpen(); if(message instanceof LocalMessage) { LocalMessage localMessage = (LocalMessage) message; @@ -166,7 +149,7 @@ public class CommunicationInterface { /** * Send a message asynchronously. */ - final void asyncSend(final Message message) { + public final void asyncSend(final Message message) { if(IS_SYNCING_MESSAGES) { syncSend(message); } else {