@Override public void sendRequest(final Request request) { // always use endpoint executor runInProtocolStage(new Runnable() { @Override public void run() { coapstack.sendRequest(request); } }); }
@Override public void sendRequest(final Request request) { // always use endpoint executor runInProtocolStage(new Runnable() { public void run() { coapstack.sendRequest(request); } }); }
/** * Makes sure that the executor has started, i.e., a thread has been * created. This is necessary for the server because it makes sure a * non-daemon thread is running. Otherwise the program might find that only * daemon threads are running and exit. */ private void startExecutor() { // Run a task that does nothing but make sure at least one thread of // the executor has started. runInProtocolStage(new Runnable() { public void run() { /* do nothing */ } }); }
/** * Makes sure that the executor has started, i.e., a thread has been * created. This is necessary for the server because it makes sure a * non-daemon thread is running. Otherwise the program might find that only * daemon threads are running and exit. */ private void startExecutor() { // Run a task that does nothing but make sure at least one thread of // the executor has started. runInProtocolStage(new Runnable() { @Override public void run() { // do nothing } }); }
@Override public void sendResponse(final Exchange exchange, final Response response) { if (exchange.hasCustomExecutor()) { // handle sending by protocol stage instead of business logic stage runInProtocolStage(new Runnable() { public void run() { coapstack.sendResponse(exchange, response); } }); } else { // use same thread to save switching overhead coapstack.sendResponse(exchange, response); } }
@Override public void sendResponse(final Exchange exchange, final Response response) { if (exchange.hasCustomExecutor()) { // handle sending by protocol stage instead of business logic stage runInProtocolStage(new Runnable() { @Override public void run() { coapstack.sendResponse(exchange, response); } }); } else { // use same thread to save switching overhead coapstack.sendResponse(exchange, response); } }