use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.
the class HadoopExternalTaskExecutionSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setMarshaller(new JdkMarshaller());
return cfg;
}
use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.
the class HadoopExternalCommunicationSelfTest method checkSimpleMessageSending.
/**
* @throws Exception If failed.
*/
private void checkSimpleMessageSending(boolean useShmem) throws Exception {
UUID parentNodeId = UUID.randomUUID();
Marshaller marsh = new JdkMarshaller();
IgniteLogger log = log();
HadoopExternalCommunication[] comms = new HadoopExternalCommunication[4];
try {
String name = "grid";
TestHadoopListener[] lsnrs = new TestHadoopListener[4];
int msgs = 10;
for (int i = 0; i < comms.length; i++) {
comms[i] = new HadoopExternalCommunication(parentNodeId, UUID.randomUUID(), marsh, log, Executors.newFixedThreadPool(1), name + i, U.defaultWorkDirectory());
if (useShmem)
comms[i].setSharedMemoryPort(14000);
lsnrs[i] = new TestHadoopListener(msgs);
comms[i].setListener(lsnrs[i]);
comms[i].start();
}
for (int r = 0; r < msgs; r++) {
for (int from = 0; from < comms.length; from++) {
for (int to = 0; to < comms.length; to++) {
if (from == to)
continue;
comms[from].sendMessage(comms[to].localProcessDescriptor(), new TestMessage(from, to));
}
}
}
U.sleep(1000);
for (TestHadoopListener lsnr : lsnrs) {
lsnr.await(3_000);
assertEquals(String.valueOf(lsnr.messages()), msgs * (comms.length - 1), lsnr.messages().size());
}
} finally {
for (HadoopExternalCommunication comm : comms) {
if (comm != null)
comm.stop();
}
}
}
use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.
the class MarshallerUtils method jdkMarshaller.
/**
* Create JDK marshaller with provided node name.
*
* @param nodeName Node name.
* @return JDK marshaller.
*/
public static JdkMarshaller jdkMarshaller(@Nullable String nodeName) {
JdkMarshaller marsh = new JdkMarshaller();
setNodeName(new JdkMarshaller(), nodeName);
return marsh;
}
use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.
the class GridDeploymentManagerStopSelfTest method testOnKernalStop.
/**
* @throws Exception If failed.
*/
public void testOnKernalStop() throws Exception {
DeploymentSpi spi = new GridTestDeploymentSpi();
GridTestKernalContext ctx = newContext();
ctx.config().setMarshaller(new JdkMarshaller());
ctx.config().setDeploymentSpi(spi);
GridResourceProcessor resProc = new GridResourceProcessor(ctx);
resProc.setSpringContext(null);
ctx.add(resProc);
GridComponent mgr = new GridDeploymentManager(ctx);
try {
mgr.onKernalStop(true);
} catch (Exception e) {
error("Error during onKernalStop() callback.", e);
assert false : "Unexpected exception " + e;
}
}
use of org.apache.ignite.marshaller.jdk.JdkMarshaller in project ignite by apache.
the class GridCacheP2PUndeploySelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setNetworkTimeout(2000);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(spi);
cfg.setMarshaller(new JdkMarshaller());
CacheConfiguration repCacheCfg = defaultCacheConfiguration();
repCacheCfg.setName("replicated");
repCacheCfg.setCacheMode(REPLICATED);
repCacheCfg.setRebalanceMode(mode);
repCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
repCacheCfg.setAtomicityMode(TRANSACTIONAL);
// TODO GG-10884.
// if (offheap)
// repCacheCfg.setOffHeapMaxMemory(OFFHEAP);
// else
// repCacheCfg.setSwapEnabled(true);
CacheConfiguration partCacheCfg = defaultCacheConfiguration();
partCacheCfg.setName("partitioned");
partCacheCfg.setCacheMode(PARTITIONED);
partCacheCfg.setRebalanceMode(mode);
partCacheCfg.setAffinity(new GridCacheModuloAffinityFunction(11, 1));
partCacheCfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
partCacheCfg.setAtomicityMode(TRANSACTIONAL);
// TODO GG-10884.
// if (offheap)
// partCacheCfg.setOffHeapMaxMemory(OFFHEAP);
// else
// partCacheCfg.setSwapEnabled(true);
cfg.setCacheConfiguration(repCacheCfg, partCacheCfg);
cfg.setDeploymentMode(SHARED);
cfg.setPeerClassLoadingLocalClassPathExclude(GridCacheP2PUndeploySelfTest.class.getName());
cfg.setUserAttributes(F.asMap(GridCacheModuloAffinityFunction.IDX_ATTR, idxGen.getAndIncrement()));
return cfg;
}
Aggregations