Search in sources :

Example 1 with OptimizedMarshaller

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) OptimizedMarshaller(org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller)

Example 2 with OptimizedMarshaller

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);
    }
}
Also used : OptimizedMarshaller(org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) NotActiveException(java.io.NotActiveException) IOException(java.io.IOException) NotSerializableException(java.io.NotSerializableException) ObjectStreamException(java.io.ObjectStreamException)

Example 3 with OptimizedMarshaller

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;
    }
}
Also used : NotSerializableException(java.io.NotSerializableException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) OptimizedMarshaller(org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller)

Example 4 with OptimizedMarshaller

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;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) OptimizedMarshaller(org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 5 with OptimizedMarshaller

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);
}
Also used : OptimizedMarshaller(org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller)

Aggregations

OptimizedMarshaller (org.apache.ignite.internal.marshaller.optimized.OptimizedMarshaller)6 NotSerializableException (java.io.NotSerializableException)2 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)2 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)2 IOException (java.io.IOException)1 NotActiveException (java.io.NotActiveException)1 ObjectStreamException (java.io.ObjectStreamException)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)1