FileDocCategorySizeDatePackage
DistributedEJBServiceFactory.javaAPI DocGlassfish v2 API5608Fri May 04 22:33:12 BST 2007com.sun.ejb.spi.distributed

DistributedEJBServiceFactory

public class DistributedEJBServiceFactory extends Object implements DistributedEJBService

Fields Summary
private static final Logger
_logger
protected static DistributedEJBService
distributedEJBService
protected static DistributedEJBTimerService
distributedEJBTimerService
private static DistributedReadOnlyBeanService
_distributedReadOnlyBeanService
Constructors Summary
protected DistributedEJBServiceFactory()

        distributedEJBService = this;
    
Methods Summary
public static DistributedEJBServicegetDistributedEJBService()

        
        if(distributedEJBService == null) {
            distributedEJBService = new DistributedEJBServiceFactory();
        } 

        return distributedEJBService;
    
public DistributedReadOnlyBeanServicegetDistributedReadOnlyBeanService()

        return _distributedReadOnlyBeanService;
    
public java.lang.String[]listTimers(java.lang.String[] serverIds)

        String[] result = new String[serverIds.length];
        if (distributedEJBTimerService != null) {
            result = distributedEJBTimerService.listTimers( serverIds );
        } else {
            //FIXME: Should throw IllegalStateException
            for (int i=0; i<serverIds.length; i++) {
                result[i] = "0";
            }
            //throw new com.sun.enterprise.admin.common.exception.AFException("EJB Timer service is null. "
                    //+ "Cannot list timers.");
        }
        
        return result;
    
public intmigrateTimers(java.lang.String serverId)
-------------------------------------------------------------- Methods to be implemented for DistributedEJBService --------------------------------------------------------------

        int result = 0;
        if (distributedEJBTimerService != null) {
            result = distributedEJBTimerService.migrateTimers( serverId );
        } else {
            //throw new IllegalStateException("EJB Timer service is null. "
                    //+ "Cannot migrate timers for: " + serverId);
        }
        
        return result;
    
public static voidsetDistributedEJBTimerService(DistributedEJBTimerService distribEJBTimerService)

        
        getDistributedEJBService();

        //The distributedEJBTimerService is the EJBTimerService that should
        //be assigned as part of the server startup. Also this code makes sense
        //in the appserv-core part of the land. But since this method is on the
        //interface even the appserv-core-ee code might call it. Need to safeguard
        //against this possibility.
        if( null == distributedEJBTimerService ) {
            distributedEJBTimerService = distribEJBTimerService;
        }
    
public voidsetPerformDBReadBeforeTimeout(boolean defaultDBReadValue)

        if( null != distributedEJBTimerService ) {
            distributedEJBTimerService.setPerformDBReadBeforeTimeout( 
                                           defaultDBReadValue );
        } else {
            // Should we ensure that the EJBTimerService can not be null
            // in the case of SE/EE
        }