session.doWork(new Work() { @Override public void execute(Connection connection) throws SQLException { //connection, finally! } });
public void applyToWriter(IndexWriterConfig writerConfig) { getIndexParameters().applyToWriter( writerConfig ); }
@Override public void doWorkInSync(LuceneWork work) { //FIXME I need a "Force sync" actually for when using PurgeAll before the indexing starts transactionalDispatcher.dispatch( work, progressMonitor ); }
@Override public String[] serialize() { return new String[] { this.getType().toString(), this.getFieldName(), String.valueOf( this.getValue() ) }; }
@Override public void performOperations(List<LuceneWork> queue, IndexingMonitor monitor) { backend.applyWork( queue, monitor ); }
@Override public synchronized void close() { if ( delegate != null ) { delegate.close(); } }
Session session = entityManager.unwrap(Session.class); session.doWork(new Work() { @Override public void execute(Connection connection) throws SQLException { // do whatever you need to do with the connection } });
@Override public void doWorkInSync(LuceneWork work) { //FIXME I need a "Force sync" actually for when using PurgeAll before the indexing starts transactionalDispatcher.dispatch( work, progressMonitor ); }
public void applyToWriter(IndexWriterConfig writerConfig) { getIndexParameters().applyToWriter( writerConfig ); }
@Override public Work createEntityWork(Serializable id, IndexedTypeIdentifier entityType, WorkType workType) { return new Work(null, entityType, id, workType); } }
@Override public void enqueueAsyncWork(LuceneWork work) throws InterruptedException { streamingDispatcher.dispatch( work, progressMonitor ); }
public class Main { public static void main(String[] args) { ExecutorServiceFactory.createScheduledExecutorService(new Work()); } }
session.doWork(new Work() { @Override public void execute(Connection con) throws SQLException { //run your query natively here } });
'Session'.doWork(new Work() { @Override public void execute(Connection c) throws SQLException { } }
public class WorkCreator { @Autowired private SomeClass workerClass; @Override public void run() { // produce work Work work = new Work(); workerClass.getWorkQueue().offer(work); } }
@Override public Work createEntityWork(Serializable id, IndexedTypeIdentifier entityType, WorkType workType) { return new Work(null, entityType, id, workType); } }
session.doWork(new Work() { @Override public void execute(Connection connection) throws SQLException { // access the connection here and perform regular jdbc operations. } });
session.doWork(new Work() { public void execute(Connection conn) { // do work with the connection ... } });