[#1472] Add a Settings.executeDebugging property, and move

server-side Console logic to core - Inlined
CommunicationInterface.{sync|async}Exec() now that these methods
provide no additional features over {sync|async}Send
This commit is contained in:
Lukas Eder 2012-09-09 12:51:03 +02:00
parent 58d22aa6ea
commit 45a5b808a3
4 changed files with 24 additions and 38 deletions

View File

@ -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<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;
}
}
@ -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);

View File

@ -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;
}

View File

@ -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 {

View File

@ -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 extends Serializable> S syncExec(CommandMessage<S> 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 extends Serializable> S syncSend(final Message<S> message) {
public final <S extends Serializable> S syncSend(final Message<S> message) {
checkOpen();
if(message instanceof LocalMessage) {
LocalMessage<S> localMessage = (LocalMessage<S>) message;
@ -166,7 +149,7 @@ public class CommunicationInterface {
/**
* Send a message asynchronously.
*/
final <S extends Serializable> void asyncSend(final Message<S> message) {
public final <S extends Serializable> void asyncSend(final Message<S> message) {
if(IS_SYNCING_MESSAGES) {
syncSend(message);
} else {