use of org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller in project ignite by apache.
the class OptimizedMarshallerAopTest method beforeTestsStarted.
/** {@inheritDoc} */
@Override
protected void beforeTestsStarted() throws Exception {
IgniteConfiguration cfg = new IgniteConfiguration();
cfg.setMarshaller(new OptimizedMarshaller());
G.start(cfg);
assert G.allGrids().size() == 1;
}
use of org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller in project ignite by apache.
the class OptimizedObjectStreamSelfTest method testPool.
/**
* @throws Exception If failed.
*/
public void testPool() throws Exception {
final TestObject obj = new TestObject();
obj.longVal = 100L;
obj.doubleVal = 100.0d;
obj.longArr = new Long[100 * 1024];
obj.doubleArr = new Double[100 * 1024];
Arrays.fill(obj.longArr, 100L);
Arrays.fill(obj.doubleArr, 100.0d);
final OptimizedMarshaller marsh = new OptimizedMarshaller();
marsh.setContext(CTX);
marsh.setPoolSize(5);
try {
multithreaded(new Callable<Object>() {
@Override
public Object call() throws Exception {
for (int i = 0; i < 50; i++) assertEquals(obj, marsh.unmarshal(marsh.marshal(obj), null));
return null;
}
}, 20);
} finally {
marsh.setPoolSize(0);
}
}
use of org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller in project ignite by apache.
the class OptimizedObjectStreamSelfTest method testRequireSerializable.
/**
* @throws Exception If failed.
*/
public void testRequireSerializable() throws Exception {
try {
OptimizedMarshaller marsh = new OptimizedMarshaller(true);
marsh.setContext(CTX);
marsh.marshal(new Object());
assert false : "Exception not thrown.";
} catch (IgniteCheckedException e) {
NotSerializableException serEx = e.getCause(NotSerializableException.class);
if (serEx == null)
throw e;
}
}
use of org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller in project ignite by apache.
the class OptimizedMarshallerNodeFailoverTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
cfg.setDiscoverySpi(disco);
cfg.setMarshaller(new OptimizedMarshaller());
cfg.setWorkDirectory(workDir);
if (cache) {
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(PARTITIONED);
ccfg.setBackups(1);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setCacheConfiguration(ccfg);
} else
cfg.setClientMode(true);
return cfg;
}
use of org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller in project ignite by apache.
the class OptimizedMarshallerPooledSelfTest method afterTestsStopped.
/** {@inheritDoc} */
@Override
protected void afterTestsStopped() throws Exception {
super.afterTestsStopped();
// Reset static registry.
new OptimizedMarshaller().setPoolSize(0);
}
Aggregations