import com.sun.jini.start.NonActivatableServiceDescriptor; import com.sun.jini.start.ServiceDescriptor; import com.sun.jini.start.SharedActivatableServiceDescriptor; import com.sun.jini.start.SharedActivationGroupDescriptor; import com.mathworks.toolbox.distcomp.mjs.service.ConfigUtil; import com.mathworks.toolbox.distcomp.control.PortConfig; /* Copyright 2004-2017 The MathWorks, Inc. */ com.sun.jini.start { // To use this config file you MUST override the input value for the following // variables when you create the configuration file. // // serviceName // jobmanagerName // lookupHosts // cleanCheckpointInfo // delayRegistration // stopOnIdle serviceType = "worker"; /* log, config, and jar directory definitions */ private static logPrefix = ConfigUtil.concat( "${com.mathworks.toolbox.distcomp.checkpointdir}${/}${com.mathworks.toolbox.distcomp.hostname}_", serviceName); private static configDir = "${com.mathworks.toolbox.distcomp.toolboxroot}${/}config${/}"; private static jarDir = "${com.mathworks.toolbox.distcomp.toolboxroot}${/}..${/}..${/}java${/}jar"; private static resourcesDir = "${com.mathworks.toolbox.distcomp.toolboxroot}${/}..${/}..${/}java${/}jar${/}resources"; private static jarextDir = "${com.mathworks.toolbox.distcomp.toolboxroot}${/}..${/}..${/}java${/}jarext"; private static toolboxJarDir = "${com.mathworks.toolbox.distcomp.toolboxroot}${/}..${/}..${/}java${/}jar${/}toolbox"; private static parallelJarDir = "${com.mathworks.toolbox.distcomp.matlabroot}${/}java${/}jar${/}toolbox${/}parallel"; private static jiniJarDir = "${com.mathworks.toolbox.distcomp.toolboxroot}${/}..${/}..${/}java${/}jarext${/}distcomp${/}jini2${/}lib"; act_sys_host = "${com.mathworks.toolbox.distcomp.hostname}"; act_sys_port = PortConfig.getPhoenixPort("${com.mathworks.toolbox.distcomp.base_port}"); persistenceDirectory = ConfigUtil.concat(logPrefix, ConfigUtil.getServicePostfix(serviceType)); checkpointDirectory = "${com.mathworks.toolbox.distcomp.checkpointdir}"; logDirectory = "${com.mathworks.toolbox.distcomp.logdir}"; matlabroot = "${com.mathworks.toolbox.distcomp.matlabroot}"; // // Shared Group Environment // // All workers in the group share the same classpath to ensure out // native code is loaded by same classloader. private static sharedVM_classpath = ConfigUtil.path(new String[]{ ConfigUtil.fullfile(jiniJarDir, "sharedvm.jar"), ConfigUtil.fullfile(jiniJarDir, "phoenix.jar"), ConfigUtil.fullfile(jiniJarDir, "reggie.jar"), ConfigUtil.fullfile(jiniJarDir, "destroy.jar"), ConfigUtil.fullfile(jiniJarDir, "jini-ext.jar"), ConfigUtil.fullfile(jarextDir, "commons-codec.jar"), ConfigUtil.fullfile(jarextDir, "commons-io.jar"), ConfigUtil.fullfile(jarextDir, "commons-lang.jar"), ConfigUtil.fullfile(parallelJarDir, "util.jar"), ConfigUtil.fullfile(parallelJarDir, "pctutil.jar"), ConfigUtil.fullfile(toolboxJarDir, "distcomp.jar"), ConfigUtil.fullfile(jarDir, "jmi.jar"), // Needed for MatlabMCR ConfigUtil.fullfile(jarDir, "mvm.jar"), // Needed for MatlabMCR ConfigUtil.fullfile(jarDir, "services.jar"), // Needed for MatlabMCR ConfigUtil.fullfile(jarDir, "util.jar"), // Needed for PlatformInfo ConfigUtil.fullfile(jarDir, "foundation_libraries.jar"), //Needed for I18n ConfigUtil.fullfile(jarDir, "resource_core.jar"), //Needed for I18n ConfigUtil.fullfile(resourcesDir, "parallel_res.jar"), //Needed for I18n "${com.mathworks.toolbox.distcomp.additionalClasspath}" }); private sharedVM_policy = ConfigUtil.fullfile(configDir,"jsk-all.policy"); // Must NOT be private sharedVM_log = ConfigUtil.concat(logPrefix, ConfigUtil.getServiceSharedVMPostfix(serviceType)); private static sharedVM_command = "${com.mathworks.toolbox.distcomp.jrecmd}"; private static jvmStartupFlags = ConfigUtil.concat( ConfigUtil.getJVMStartupFlags("${com.mathworks.toolbox.distcomp.jreflags}"), ConfigUtil.getJVMDebugProperties("NO_DEBUGGING") // change this to a valid port to enable debugging ); // -Xrs: Reduces usage of operating-system signals by the Java virtual machine (JVM) private static extraJVMFlags = new String[]{"-Xrs","-Xmx1024m","-XX:ParallelGCThreads=6"}; private static sharedVM_options = ConfigUtil.concat(jvmStartupFlags, extraJVMFlags); private static sharedVM_properties = new String[]{ "java.security.manager", "com.mathworks.toolbox.distcomp.util.AllowAllSecurityManager", "java.library.path", "${com.mathworks.toolbox.distcomp.library_path}", "java.security.egd", "file:/dev/urandom", "java.rmi.server.useCodebaseOnly", "true", "sun.net.inetaddr.ttl", "${com.mathworks.toolbox.distcomp.DNS_lookupInterval}", "sun.rmi.transport.connectionTimeout", "${com.mathworks.toolbox.distcomp.RMI_connectionTimeout}", "sun.rmi.transport.tcp.readTimeout", "${com.mathworks.toolbox.distcomp.RMI_readTimeout}", "sun.rmi.dgc.client.gcInterval", "${com.mathworks.toolbox.distcomp.jobmanager_gcInterval}"}; private static sharedVM = new SharedActivationGroupDescriptor( sharedVM_policy, sharedVM_classpath, sharedVM_log, sharedVM_command, sharedVM_options, sharedVM_properties, act_sys_host, act_sys_port); // // MatlabWorker // // MATLAB stdout and stderr streams are written to this file. private static matlabOutputFilePattern = ConfigUtil.concat(new String[]{ "${com.mathworks.toolbox.distcomp.logdir}${/}", "worker-matlab-output_", "${com.mathworks.toolbox.distcomp.hostname}_", ConfigUtil.concat( serviceName, "_" ), ConfigUtil.getTimeStamp(), ".%u.%g", //unique number and sequence number ".log"}); private static mlworker_codebase = ""; private static mlworker_policy = ConfigUtil.fullfile(configDir,"jsk-all.policy"); private static mlworker_classpath = ""; private static mlworker_impl = "com.mathworks.toolbox.distcomp.mjs.worker.WorkerImpl"; private static mlworker_config = ConfigUtil.fullfile(configDir,"mlworker.config"); private static mlworker_service = new SharedActivatableServiceDescriptor( mlworker_codebase, mlworker_policy, mlworker_classpath, mlworker_impl, sharedVM_log, new String[]{ mlworker_config, "com.mathworks.toolbox.distcomp.servicename", serviceName, "com.mathworks.toolbox.distcomp.jobmanagername", jobmanagerName, "com.mathworks.toolbox.distcomp.membergroups", "${com.mathworks.toolbox.distcomp.membergroups}", "com.mathworks.toolbox.distcomp.logdir", "${com.mathworks.toolbox.distcomp.logdir}", "com.mathworks.toolbox.distcomp.checkpointdir", "${com.mathworks.toolbox.distcomp.checkpointdir}", "com.mathworks.toolbox.distcomp.persistenceDir", persistenceDirectory, "com.mathworks.toolbox.distcomp.base_port", "${com.mathworks.toolbox.distcomp.base_port}", "com.mathworks.toolbox.distcomp.lookup_hosts", lookupHosts, "com.mathworks.toolbox.distcomp.clean_checkpoint_info", cleanCheckpointInfo, "com.mathworks.toolbox.distcomp.toolboxroot", "${com.mathworks.toolbox.distcomp.toolboxroot}", "com.mathworks.toolbox.distcomp.loglevel", "${com.mathworks.toolbox.distcomp.loglevel}", "com.mathworks.toolbox.distcomp.matlabroot", "${com.mathworks.toolbox.distcomp.matlabroot}", "com.mathworks.toolbox.distcomp.matlabexecutable", "${com.mathworks.toolbox.distcomp.matlabexecutable}", "com.mathworks.toolbox.distcomp.matlabOutputFilePattern", matlabOutputFilePattern, "com.mathworks.toolbox.distcomp.workerstarttimeout", "${com.mathworks.toolbox.distcomp.workerstarttimeout}", "com.mathworks.toolbox.distcomp.securityLevel", "${com.mathworks.toolbox.distcomp.securityLevel}", "com.mathworks.toolbox.distcomp.securityDir", "${com.mathworks.toolbox.distcomp.securityDir}", "com.mathworks.toolbox.distcomp.worker.windowsDomain", "${com.mathworks.toolbox.distcomp.worker.windowsDomain}", "com.mathworks.toolbox.distcomp.rmi.useSecureCommunication", "${com.mathworks.toolbox.distcomp.rmi.useSecureCommunication}", "com.mathworks.toolbox.distcomp.requireWebLicensing", "${com.mathworks.toolbox.distcomp.requireWebLicensing}", "com.mathworks.toolbox.distcomp.rmi.requireClientCertificate", "${com.mathworks.toolbox.distcomp.rmi.requireClientCertificate}", "com.mathworks.toolbox.distcomp.rmi.secureDataTransfer", "true", "com.mathworks.toolbox.distcomp.mjs.security.keystorePath", "${com.mathworks.toolbox.distcomp.mjs.security.keystorePath}", "com.mathworks.toolbox.distcomp.mjs.security.defaultKeystorePath", "${com.mathworks.toolbox.distcomp.mjs.security.defaultKeystorePath}", "com.mathworks.toolbox.distcomp.mjs.security.keystorePassword", "${com.mathworks.toolbox.distcomp.mjs.security.keystorePassword}", "com.mathworks.toolbox.distcomp.rmi.useServerSpecifiedHostname", "true", "com.mathworks.toolbox.distcomp.worker.lifecycleReporter", "${com.mathworks.toolbox.distcomp.worker.lifecycleReporter}", "com.mathworks.toolbox.distcomp.worker.workerLifecycleHeartBeat","${com.mathworks.toolbox.distcomp.worker.workerLifecycleHeartBeat}", "com.mathworks.toolbox.distcomp.worker.taskLifecycleHeartBeat", "${com.mathworks.toolbox.distcomp.worker.taskLifecycleHeartBeat}", "com.mathworks.toolbox.distcomp.hostname", "${com.mathworks.toolbox.distcomp.hostname}", "java.rmi.server.hostname", "${com.mathworks.toolbox.distcomp.hostname}", "com.mathworks.toolbox.distcomp.worker.onDemand", "${com.mathworks.toolbox.distcomp.worker.onDemand}", "com.mathworks.toolbox.distcomp.delay_registration", delayRegistration, "com.mathworks.toolbox.distcomp.stop_on_idle", stopOnIdle, "com.mathworks.toolbox.distcomp.pmode.keepAlivePeriod", "${com.mathworks.toolbox.distcomp.pmode.keepAlivePeriod}", "com.mathworks.toolbox.distcomp.pmode.keepAliveTimeUnit", "${com.mathworks.toolbox.distcomp.pmode.keepAliveTimeUnit}", "com.mathworks.toolbox.distcomp.matlabDriveEnabledOnWorker", "${com.mathworks.toolbox.distcomp.matlabDriveEnabledOnWorker}", "com.mathworks.toolbox.distcomp.matlabDriveFolderLocationCfg", "${com.mathworks.toolbox.distcomp.matlabDriveFolderLocationCfg}" }, true, act_sys_host, act_sys_port); // // Services to start -- used by ServiceStarter.main() // static serviceDescriptors = new ServiceDescriptor[] { sharedVM, mlworker_service }; // // Shared Group // private static shared_group_codebase = ""; private static shared_group_policy = ConfigUtil.fullfile(configDir,"jsk-all.policy"); private static shared_group_classpath = ConfigUtil.fullfile(jiniJarDir, "group.jar"); private static shared_group_config = ConfigUtil.fullfile(configDir, "group.config"); private static shared_group_impl = "com.sun.jini.start.SharedGroupImpl"; private static shared_group_service = new SharedActivatableServiceDescriptor( shared_group_codebase, shared_group_policy, shared_group_classpath, shared_group_impl, sharedVM_log, // Same as above new String[] { shared_group_config }, false, act_sys_host, act_sys_port); // // Groups to destroy -- used by DestroySharedGroup.main() // static serviceDestructors = new ServiceDescriptor[] { shared_group_service }; }