Java Code Examples for org.ehcache.spi.serialization.UnsupportedTypeException

Following code examples demonstrate how to use org.ehcache.spi.serialization.UnsupportedTypeExceptionfrom ehcache. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.ehcache.spi.serialization.UnsupportedTypeExceptionand various code implementation of this class.

  protected OffHeapStore<String, String> createAndInitStore(TimeSource timeSource, ExpiryPolicy<? super String, ? super String> expiry) {
    try {
      SerializationProvider serializationProvider = new DefaultSerializationProvider(null);
      serializationProvider.start(providerContaining());
      ClassLoader classLoader = getClass().getClassLoader();
      Serializer<String> keySerializer = serializationProvider.createKeySerializer(String.class, classLoader);
      Serializer<String> valueSerializer = serializationProvider.createValueSerializer(String.class, classLoader);
      StoreConfigurationImpl<String, String> storeConfiguration = new StoreConfigurationImpl<>(String.class, String.class,
        null, classLoader, expiry, null, 0, keySerializer, valueSerializer);
      OffHeapStore<String, String> offHeapStore = new OffHeapStore<>(storeConfiguration, timeSource, new TestStoreEventDispatcher<>(), MemoryUnit.MB
        .toBytes(1));
      OffHeapStore.Provider.init(offHeapStore);
      return offHeapStore;
    } catch (UnsupportedTypeException e) {
      throw new AssertionError(e);
    }
  } 


  public void setup() throws UnsupportedTypeException {
    SerializationProvider provider = new DefaultSerializationProvider(null);
    provider.start(providerContaining());
    valueHolderPortability = new OffHeapValueHolderPortability<>(provider
      .createValueSerializer(String.class, getClass().getClassLoader()));

    originalValue = new BasicOffHeapValueHolder<>(-1, "aValue", 1L, 2L, 3L, 0);

  } 

Advertisement
Javadoc
Exception thrown by the SerializationProvider to indicate a Serializer could not be created for a gi

ven type.

Read More
Advertisement