Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2008, Red Hat Middleware LLC, and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.jboss.as.ejb3.cache.impl.factory;
 
 import java.io.File;
 
org.jboss.as.ejb3.cache.spi.BackingCacheEntryStoreSource for a non-clustered cache. Uses a org.jboss.as.ejb3.cache.spi.impl.FilePersistentObjectStore store for persistence.

Author(s):
Brian Stansberry
Paul Ferraro
 
 public class NonClusteredBackingCacheEntryStoreSource<K extends Serializable, V extends Cacheable<K>, G extends Serializableextends AbstractBackingCacheEntryStoreSource<K, V, G> {
    
The default session store directory name ("ejb3/sessions").
 
     public static final String DEFAULT_SESSION_DIRECTORY_NAME = "ejb3" + . + "sessions";

    
The default session group store directory name ("ejb3/sfsbgroups").
 
     public static final String DEFAULT_GROUP_DIRECTORY_NAME = "ejb3" + . + "groups";
 
     public static final String DEFAULT_RELATIVE_TO = .;
     public static final int DEFAULT_SUBDIRECTORY_COUNT = 100;
 
     private final InjectedValue<PathManagerpathManager = new InjectedValue<PathManager>();
     private String relativeToRef = ;
     private int subdirectoryCount = ;
     private volatile PathManager.Callback.Handle callbackHandle;
 
     @Override
     public <E extends SerializationGroup<K, V, G>> BackingCacheEntryStore<G, Cacheable<G>, E> createGroupIntegratedObjectStore(IdentifierFactory<G> identifierFactoryPassivationManager<G, E> passivationManagerStatefulTimeoutInfo timeout) {
         FilePersistentObjectStore<G, E> objectStore = new FilePersistentObjectStore<G, E>(passivationManagerthis.getStoragePath(nullthis.), );
 
         SimpleBackingCacheEntryStore<G, Cacheable<G>, E> store = new SimpleBackingCacheEntryStore<G, Cacheable<G>, E>(identifierFactoryobjectStorethis..getValue(), timeoutthis);
 
         return store;
     }
 
     @Override
     public <E extends SerializationGroupMember<K, V, G>> BackingCacheEntryStore<K, V, E> createIntegratedObjectStore(String beanNameIdentifierFactory<K> identifierFactoryPassivationManager<K, E> passivationManagerStatefulTimeoutInfo timeout) {
         FilePersistentObjectStore<K, E> objectStore = new FilePersistentObjectStore<K, E>(passivationManagerthis.getStoragePath(beanNamethis.), );
 
         SimpleBackingCacheEntryStore<K, V, E> store = new SimpleBackingCacheEntryStore<K, V, E>(identifierFactoryobjectStorethis..getValue(), timeoutthis);
 
         return store;
     }
 
     @Override
     public void addDependencies(ServiceTarget targetServiceBuilder<?> builder) {
         builder.addDependency(.PathManager.classthis.);
     }
 
     private String getStoragePath(String beanNameString subDirectory) {
        File path = new File(.getValue().resolveRelativePathEntry(subDirectory));
        return path.getAbsolutePath();
    }

    
Gets the name of the subdirectory under the base directory under which sessions should be stored. Default is DEFAULT_SESSION_DIRECTORY_NAME.
    public String getSessionDirectoryName() {
        return ;
    }

    
Sets the name of the subdirectory under the base directory under which sessions should be stored.
    public void setSessionDirectoryName(String directoryName) {
        this. = directoryName;
    }

    
Gets the name of the subdirectory under the base directory under which session groups should be stored. Default is DEFAULT_GROUP_DIRECTORY_NAME.
    public String getGroupDirectoryName() {
        return ;
    }

    
Sets the name of the subdirectory under the base directory under which session groups should be stored.
    public void setGroupDirectoryName(String groupDirectoryName) {
        this. = groupDirectoryName;
    }

    
Gets the number of subdirectories under the session directory or the group directory into which the sessions/groups should be divided. Using subdirectories helps overcome filesystem limits on the number of items that can be stored. Default is DEFAULT_SUBDIRECTORY_COUNT.
    public int getSubdirectoryCount() {
        return ;
    }

    
Sets the number of subdirectories under the session directory or the group directory into which the sessions/groups should be divided.
    public void setSubdirectoryCount(int subdirectoryCount) {
        this. = subdirectoryCount;
    }
    public String getRelativeTo() {
        return this.;
    }
    public void setRelativeTo(String relativeTo) {
        //TODO - should this cause any bounce of the service
        this. = relativeTo;
    }
    @Override
    public void started() {
        if ( != null) {
             = .getValue().registerCallback(, PathManager.ReloadServerCallback.create(), ....);
        }
    }
    @Override
    public void stopped() {
        if ( != null) {
            .remove();
             = null;
        }
    }
New to GrepCode? Check out our FAQ X