1 23 package com.sun.enterprise.management.config; 24 25 import java.util.Map ; 26 import java.util.Set ; 27 import java.util.Collections ; 28 29 import javax.management.ObjectName ; 30 import javax.management.AttributeList ; 31 32 import com.sun.appserv.management.base.XTypes; 33 import com.sun.appserv.management.base.Util; 34 35 import com.sun.appserv.management.util.misc.MapUtil; 36 import com.sun.appserv.management.util.misc.GSetUtil; 37 38 import com.sun.enterprise.management.support.Delegate; 39 import com.sun.enterprise.management.support.oldconfig.OldThreadPoolsConfigMBean; 40 41 42 import com.sun.appserv.management.config.ThreadPoolConfigKeys; 43 44 45 46 49 public final class ThreadPoolConfigFactory extends ConfigFactory 50 { 51 public 52 ThreadPoolConfigFactory( final ConfigFactoryCallback callbacks ) 53 { 54 super( callbacks ); 55 } 56 57 private final Set <String > LEGAL_OPTIONAL_KEYS = 58 GSetUtil.newUnmodifiableStringSet( 59 ThreadPoolConfigKeys.MIN_THREAD_POOL_SIZE_KEY, 60 ThreadPoolConfigKeys.MAX_THREAD_POOL_SIZE_KEY, 61 ThreadPoolConfigKeys.IDLE_THREAD_TIMEOUT_IN_SECONDS_KEY, 62 ThreadPoolConfigKeys.NUM_WORK_QUEUES_KEY 63 ); 64 65 protected Set <String > 66 getLegalOptionalCreateKeys() 67 { 68 return( LEGAL_OPTIONAL_KEYS ); 69 } 70 71 72 private OldThreadPoolsConfigMBean 73 getOldThreadPoolsConfigMBean( ) 74 { 75 return getOldConfigProxies().getOldThreadPoolsConfigMBean( getConfigName() ); 76 } 77 78 85 public ObjectName 86 create( String name, Map <String ,String > optional ) 87 { 88 final Map <String ,String > params = initParams( name, null, optional ); 89 90 final ObjectName amxName = createNamedChild( name, params ); 91 92 return( amxName ); 93 } 94 95 public void 96 internalRemove( final ObjectName objectName) 97 { 98 final String name = Util.getName( objectName ); 99 100 getOldThreadPoolsConfigMBean().removeThreadPoolByThreadPoolId( name ); 101 } 102 103 protected Map <String ,String > 104 getParamNameOverrides() 105 { 106 return( MapUtil.newMap( CONFIG_NAME_KEY, "thread-pool-id" ) ); 107 } 108 109 protected ObjectName 110 createOldChildConfig( final AttributeList translatedAttrs ) 111 { 112 final ObjectName objectName = 113 getOldThreadPoolsConfigMBean().createThreadPool( translatedAttrs ); 114 115 return( objectName ); 116 } 117 118 } 119 120 | Popular Tags |