Search in sources :

Example 11 with BackingStoreException

use of org.glassfish.ha.store.api.BackingStoreException in project Payara by payara.

the class HACNonceCacheImpl method postConstruct.

public void postConstruct() {
    localStore = new CNonceCacheImpl();
    try {
        final BackingStoreConfiguration<String, NonceInfo> bsConfig = new BackingStoreConfiguration<String, NonceInfo>();
        bsConfig.setClusterName(props.get(CNonceCacheFactory.CLUSTER_NAME_PROP)).setInstanceName(props.get(CNonceCacheFactory.INSTANCE_NAME_PROP)).setStoreName(storeName).setKeyClazz(String.class).setValueClazz(NonceInfo.class);
        BackingStoreFactory bsFactory = services.getService(BackingStoreFactory.class, BS_TYPE_REPLICATED);
        backingStore = bsFactory.createBackingStore(bsConfig);
    } catch (BackingStoreException ex) {
        logger.log(Level.WARNING, null, ex);
    }
}
Also used : BackingStoreFactory(org.glassfish.ha.store.api.BackingStoreFactory) NonceInfo(org.glassfish.security.common.NonceInfo) BackingStoreException(org.glassfish.ha.store.api.BackingStoreException) CNonceCacheImpl(com.sun.web.security.CNonceCacheImpl) BackingStoreConfiguration(org.glassfish.ha.store.api.BackingStoreConfiguration)

Example 12 with BackingStoreException

use of org.glassfish.ha.store.api.BackingStoreException in project Payara by payara.

the class ReplicationStore method doSave.

/**
 * Save the specified Session into this Store.  Any previously saved
 * information for the associated session identifier is replaced.
 *
 * @param session Session to be saved
 *
 * @exception IOException if an input/output error occurs
 */
public void doSave(Session session) throws IOException {
    if (!(session instanceof HASession)) {
        return;
    }
    byte[] sessionState = this.getByteArray(session, isReplicationCompressionEnabled());
    SimpleMetadata simpleMetadata = // version
    SimpleMetadataFactory.createSimpleMetadata(// version
    session.getVersion(), // lastaccesstime
    session.getLastAccessedTime(), // maxinactiveinterval
    session.getMaxInactiveInterval() * 1000L, // state
    sessionState);
    try {
        BackingStore<String, SimpleMetadata> backingStore = getSimpleMetadataBackingStore();
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("ReplicationStore>>save: backing store : " + backingStore);
        }
        // id
        backingStore.save(// id
        session.getIdInternal(), simpleMetadata, // TODO: Revist the last param
        !((HASession) session).isPersistent());
    } catch (BackingStoreException ex) {
        throw new IOException("Error during save: " + ex.getMessage(), ex);
    }
}
Also used : BackingStoreException(org.glassfish.ha.store.api.BackingStoreException) SimpleMetadata(org.glassfish.ha.store.util.SimpleMetadata)

Example 13 with BackingStoreException

use of org.glassfish.ha.store.api.BackingStoreException in project Payara by payara.

the class ReplicationWebEventPersistentManager method createBackingStore.

@Override
public void createBackingStore(String persistenceType, String storeName, Class<T> metadataClass, Map<String, Object> vendorMap) {
    if (_logger.isLoggable(Level.FINE)) {
        _logger.fine("Create backing store invoked with persistence type " + persistenceType + " and store name " + storeName);
    }
    BackingStoreFactory factory = services.getService(BackingStoreFactory.class, persistenceType);
    BackingStoreConfiguration<String, T> conf = new BackingStoreConfiguration<String, T>();
    HazelcastCore hazelcast = services.getService(HazelcastCore.class);
    if (hazelcast.isEnabled()) {
        clusterName = hazelcast.getMemberGroup();
        instanceName = hazelcast.getMemberName();
    }
    conf.setStoreName(storeName).setClusterName(clusterName).setInstanceName(instanceName).setStoreType(persistenceType).setKeyClazz(String.class).setValueClazz(metadataClass).setClassLoader(this.getClass().getClassLoader());
    if (vendorMap != null) {
        conf.getVendorSpecificSettings().putAll(vendorMap);
    }
    try {
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("About to create backing store " + conf);
        }
        this.backingStore = factory.createBackingStore(conf);
    } catch (BackingStoreException e) {
        _logger.log(Level.WARNING, LogFacade.COULD_NOT_CREATE_BACKING_STORE, e);
    }
    Object obj = conf.getVendorSpecificSettings().get("key.mapper");
    if (obj != null && obj instanceof GlassFishHAReplicaPredictor) {
        predictor = (GlassFishHAReplicaPredictor) obj;
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("ReplicatedManager.keymapper is " + predictor);
        }
    } else {
        predictor = new NoopHAReplicaPredictor();
    }
}
Also used : BackingStoreFactory(org.glassfish.ha.store.api.BackingStoreFactory) HazelcastCore(fish.payara.nucleus.hazelcast.HazelcastCore) BackingStoreException(org.glassfish.ha.store.api.BackingStoreException) GlassFishHAReplicaPredictor(org.glassfish.ha.common.GlassFishHAReplicaPredictor) NoopHAReplicaPredictor(org.glassfish.ha.common.NoopHAReplicaPredictor) BackingStoreConfiguration(org.glassfish.ha.store.api.BackingStoreConfiguration)

Aggregations

BackingStoreException (org.glassfish.ha.store.api.BackingStoreException)13 SimpleMetadata (org.glassfish.ha.store.util.SimpleMetadata)5 BackingStoreConfiguration (org.glassfish.ha.store.api.BackingStoreConfiguration)4 BackingStoreFactory (org.glassfish.ha.store.api.BackingStoreFactory)4 EJBObject (javax.ejb.EJBObject)3 HazelcastCore (fish.payara.nucleus.hazelcast.HazelcastCore)2 Serializable (java.io.Serializable)2 SingleSignOnEntry (org.apache.catalina.authenticator.SingleSignOnEntry)2 ComponentContext (com.sun.ejb.ComponentContext)1 EjbInvocation (com.sun.ejb.EjbInvocation)1 CNonceCacheImpl (com.sun.web.security.CNonceCacheImpl)1 File (java.io.File)1 IOException (java.io.IOException)1 NotSerializableException (java.io.NotSerializableException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 RemoteException (java.rmi.RemoteException)1 ArrayList (java.util.ArrayList)1 Iterator (java.util.Iterator)1 ConcurrentAccessException (javax.ejb.ConcurrentAccessException)1 ConcurrentAccessTimeoutException (javax.ejb.ConcurrentAccessTimeoutException)1