1 23 24 package com.sun.ejb.spi.distributed; 25 26 import java.io.ByteArrayInputStream ; 27 import java.io.ByteArrayOutputStream ; 28 import java.io.IOException ; 29 import java.io.ObjectInputStream ; 30 import java.io.ObjectOutputStream ; 31 import java.io.Serializable ; 32 33 import java.util.logging.Logger ; 34 import java.util.logging.Level ; 35 36 import com.sun.logging.LogDomains; 37 38 import java.util.concurrent.ConcurrentHashMap ; 39 40 public class DistributedEJBServiceFactory 41 implements DistributedEJBService 42 { 43 44 private static Logger _logger = 45 LogDomains.getLogger(LogDomains.EJB_LOGGER); 46 47 protected static DistributedEJBService distributedEJBService = null; 48 protected static DistributedEJBTimerService distributedEJBTimerService = null; 49 50 private static DistributedReadOnlyBeanService _distributedReadOnlyBeanService 51 = new DistributedReadOnlyBeanServiceImpl(); 52 public static DistributedEJBService getDistributedEJBService() { 53 if(distributedEJBService == null) { 54 distributedEJBService = new DistributedEJBServiceFactory(); 55 } 56 57 return distributedEJBService; 58 } 59 60 protected DistributedEJBServiceFactory() { 61 distributedEJBService = this; 62 } 63 64 65 public static void setDistributedEJBTimerService( 66 DistributedEJBTimerService distribEJBTimerService ) { 67 68 getDistributedEJBService(); 69 70 if( null == distributedEJBTimerService ) { 76 distributedEJBTimerService = distribEJBTimerService; 77 } 78 } 79 80 85 public int migrateTimers( String serverId ) { 86 int result = 0; 87 if (distributedEJBTimerService != null) { 88 result = distributedEJBTimerService.migrateTimers( serverId ); 89 } else { 90 } 93 94 return result; 95 } 96 97 public String [] listTimers( String [] serverIds ) { 98 String [] result = new String [serverIds.length]; 99 if (distributedEJBTimerService != null) { 100 result = distributedEJBTimerService.listTimers( serverIds ); 101 } else { 102 for (int i=0; i<serverIds.length; i++) { 104 result[i] = "0"; 105 } 106 } 109 110 return result; 111 } 112 113 public void setPerformDBReadBeforeTimeout( boolean defaultDBReadValue ) { 114 if( null != distributedEJBTimerService ) { 115 distributedEJBTimerService.setPerformDBReadBeforeTimeout( 116 defaultDBReadValue ); 117 } else { 118 } 121 } 122 123 public DistributedReadOnlyBeanService getDistributedReadOnlyBeanService() { 124 return _distributedReadOnlyBeanService; 125 } 126 127 } 129 | Popular Tags |