com.hazelcast.core.IExecutorService Java Examples
The following examples show how to use
com.hazelcast.core.IExecutorService.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LumongoIndexManager.java From lumongo with Apache License 2.0 | 6 votes |
public IndexSettingsResponse updateIndex(String indexName, org.lumongo.cluster.message.LumongoIndex.IndexSettings request) throws InvalidIndexConfig, MongoException, IOException { globalLock.readLock().lock(); try { log.info("Updating index settings for <" + indexName + ">:\n" + JsonFormat.printer().print(request)); LumongoIndex i = indexMap.get(indexName); if (i == null) { throw new IndexDoesNotExist(indexName); } i.updateIndexSettings(request); Set<Member> currentMembers = hazelcastManager.getMembers(); IExecutorService executorService = hazelcastManager.getExecutorService(); Member self = hazelcastManager.getSelf(); for (Member m : currentMembers) { try { ReloadIndexSettingsTask rist = new ReloadIndexSettingsTask(m.getSocketAddress().getPort(), indexName); if (!self.equals(m)) { Future<Void> dt = executorService.submitToMember(rist, m); dt.get(); } else { rist.call(); } } catch (Exception e) { log.error(e.getClass().getSimpleName() + ": ", e); } } return IndexSettingsResponse.newBuilder().build(); } finally { globalLock.readLock().unlock(); } }
Example #2
Source File: ExecutorTest.java From hazelcast-simulator with Apache License 2.0 | 5 votes |
@Setup public void setup() { executors = new IExecutorService[executorCount]; for (int i = 0; i < executors.length; i++) { executors[i] = targetInstance.getExecutorService(name + '-' + i); } executedCounter = getAtomicLong(name + ":ExecutedCounter"); expectedExecutedCounter = getAtomicLong(name + ":ExpectedExecutedCounter"); }
Example #3
Source File: ExecutorTest.java From hazelcast-simulator with Apache License 2.0 | 5 votes |
@Teardown(global = true) public void teardown() throws Exception { executedCounter.destroy(); expectedExecutedCounter.destroy(); for (IExecutorService executor : executors) { executor.shutdownNow(); if (!executor.awaitTermination(120, TimeUnit.SECONDS)) { logger.fatal("Time out while waiting for shutdown of executor: " + executor.getName()); } executor.destroy(); } }
Example #4
Source File: WebConfigurerTest.java From flair-engine with Apache License 2.0 | 4 votes |
@Override public IExecutorService getExecutorService(String s) { return null; }
Example #5
Source File: HazelcastCommandExecutor.java From concursus with MIT License | 4 votes |
private HazelcastCommandExecutor(IExecutorService executorService) { this.executorService = executorService; }
Example #6
Source File: LumongoIndexManager.java From lumongo with Apache License 2.0 | 4 votes |
public IndexDeleteResponse deleteIndex(IndexDeleteRequest request) throws Exception { globalLock.writeLock().lock(); try { String indexName = request.getIndexName(); LumongoIndex i = indexMap.get(indexName); if (i == null) { if (getIndexNames().contains(indexName)) { //TODO delete index from database return IndexDeleteResponse.newBuilder().build(); } else { throw new IndexDoesNotExist(indexName); } } Set<Member> currentMembers = hazelcastManager.getMembers(); IExecutorService executorService = hazelcastManager.getExecutorService(); Member self = hazelcastManager.getSelf(); log.info("Unload index <" + indexName + "> for delete"); for (Member m : currentMembers) { try { UnloadIndexTask uit = new UnloadIndexTask(m.getSocketAddress().getPort(), indexName, true); if (!self.equals(m)) { Future<Void> dt = executorService.submitToMember(uit, m); dt.get(); } else { uit.call(); } } catch (Exception e) { log.error(e.getClass().getSimpleName() + ": ", e); } } log.info("Deleting index <" + indexName + ">"); i.deleteIndex(); indexMap.remove(indexName); return IndexDeleteResponse.newBuilder().build(); } finally { globalLock.writeLock().unlock(); } }
Example #7
Source File: HazelcastManager.java From lumongo with Apache License 2.0 | 4 votes |
public IExecutorService getExecutorService() { return hazelcastInstance.getExecutorService("default"); }
Example #8
Source File: HazelcastCommandExecutor.java From concursus with MIT License | 2 votes |
/** * Create a new {@link HazelcastCommandExecutor} using the supplied {@link IExecutorService}. * @param executorService The {@link IExecutorService} to use to execute {@link Command}s. * @return The constructed {@link CommandExecutor}. */ public static CommandExecutor using(IExecutorService executorService) { return new HazelcastCommandExecutor(executorService); }