For IntelliJ IDEA,
Android Studio or Eclipse



public boolean executeInLock(final OCallable<Boolean, ODistributedResponseManager> callback) { synchronousResponsesLock.lock(); try { return callback.call(this); } finally { synchronousResponsesLock.unlock(); } }
protected void execInSeparateDatabase(final OCallable iCallback) { final ODatabaseDocumentInternal prevDb = ODatabaseRecordThreadLocal.instance().getIfDefined(); try { iCallback.call(null); } finally { if (prevDb != null) { ODatabaseRecordThreadLocal.instance().set(prevDb); } else { ODatabaseRecordThreadLocal.instance().remove(); } } }
public void sendStream(final int iCode, final String iReason, final String iContentType, final String iFileName, final OCallable<Void, OChunkedResponse> iWriter) throws IOException { writeStatus(iCode, iReason); writeHeaders(iContentType); writeLine("Content-Transfer-Encoding: binary"); writeLine("Transfer-Encoding: chunked"); if (iFileName != null) { writeLine("Content-Disposition: attachment; filename=\"" + iFileName + "\""); } writeLine(null); final OChunkedResponse chunkedOutput = new OChunkedResponse(this); iWriter.call(chunkedOutput); chunkedOutput.close(); flush(); }
public OCommandExecutor getExecutor(OCommandRequestInternal iCommand) { final Class<? extends OCommandExecutor> executorClass = commandReqExecMap.get(iCommand.getClass()); if (executorClass == null) throw new OCommandExecutorNotFoundException("Cannot find a command executor for the command request: " + iCommand); try { final OCommandExecutor exec = executorClass.newInstance(); final OCallable<Void, OCommandRequest> callback = configCallbacks.get(iCommand.getClass()); if (callback != null) callback.call(iCommand); return exec; } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException("Cannot create the command executor of class " + executorClass + " for the command request: " + iCommand), e); } } }
public void closeAndMove(OCallable<Void, String> mover) { stateLock.acquireWriteLock(); try { this.close(true, false); mover.call(this.storagePath); } finally { stateLock.releaseWriteLock(); } }
public static Object convert(final Object iObject, final OCallable<Object, Object> iCallback) { return iCallback != null ? iCallback.call(iObject) : iObject; }
public void executeInDBScope(OCallable<Void, ODatabase> callback) { final ODatabaseDocumentInternal currentDB = ODatabaseRecordThreadLocal.instance().getIfDefined(); try { final ODatabase<?> db = openSystemDatabase(); try { callback.call(db); } finally { db.close(); } } finally { if (currentDB != null) ODatabaseRecordThreadLocal.instance().set(currentDB); else ODatabaseRecordThreadLocal.instance().remove(); } }
public boolean executeInLock(final OCallable<Boolean, ODistributedResponseManager> callback) { synchronousResponsesLock.lock(); try { return callback.call(this); } finally { synchronousResponsesLock.unlock(); } }
public boolean executeInLock(final OCallable<Boolean, ODistributedResponseManager> callback) { synchronousResponsesLock.lock(); try { return callback.call(this); } finally { synchronousResponsesLock.unlock(); } }
public static Object convert(final Object iObject, final OCallable<Object, Object> iCallback) { return iCallback != null ? iCallback.call(iObject) : iObject; }
public void sendStream(final int iCode, final String iReason, final String iContentType, final String iFileName, final OCallable<Void, OChunkedResponse> iWriter) throws IOException { writeStatus(iCode, iReason); writeHeaders(iContentType); writeLine("Content-Transfer-Encoding: binary"); writeLine("Transfer-Encoding: chunked"); if (iFileName != null) { writeLine("Content-Disposition: attachment; filename=\"" + iFileName + "\""); } writeLine(null); final OChunkedResponse chunkedOutput = new OChunkedResponse(this); iWriter.call(chunkedOutput); chunkedOutput.close(); flush(); }
public void sendStream(final int iCode, final String iReason, final String iContentType, final String iFileName, final OCallable<Void, OChunkedResponse> iWriter) throws IOException { writeStatus(iCode, iReason); writeHeaders(iContentType); writeLine("Content-Transfer-Encoding: binary"); writeLine("Transfer-Encoding: chunked"); if (iFileName != null) { writeLine("Content-Disposition: attachment; filename=\"" + iFileName + "\""); } writeLine(null); final OChunkedResponse chunkedOutput = new OChunkedResponse(this); iWriter.call(chunkedOutput); chunkedOutput.close(); flush(); }
public OCommandExecutor getExecutor(OCommandRequestInternal iCommand) { final Class<? extends OCommandExecutor> executorClass = commandReqExecMap.get(iCommand.getClass()); if (executorClass == null) throw new OCommandExecutorNotFoundException("Cannot find a command executor for the command request: " + iCommand); try { final OCommandExecutor exec = executorClass.newInstance(); final OCallable<Void, OCommandRequest> callback = configCallbacks.get(iCommand.getClass()); if (callback != null) callback.call(iCommand); return exec; } catch (Exception e) { throw OException.wrapException(new OCommandExecutionException("Cannot create the command executor of class " + executorClass + " for the command request: " + iCommand), e); } } }
public void executeInDBScope(OCallable<Void, ODatabase> callback) { final ODatabaseDocumentInternal currentDB = ODatabaseRecordThreadLocal.instance().getIfDefined(); try { final ODatabase<?> db = openSystemDatabase(); try { callback.call(db); } finally { db.close(); } } finally { if (currentDB != null) ODatabaseRecordThreadLocal.instance().set(currentDB); else ODatabaseRecordThreadLocal.instance().remove(); } }
public void executeInDBScope(OCallable<Void, ODatabase> callback) { final ODatabaseDocumentInternal currentDB = ODatabaseRecordThreadLocal.instance().getIfDefined(); try { final ODatabase<?> db = openSystemDatabase(); try { callback.call(db); } finally { db.close(); } } finally { if (currentDB != null) ODatabaseRecordThreadLocal.instance().set(currentDB); else ODatabaseRecordThreadLocal.instance().remove(); } }