Many thanks to John Baker from Java Systems Solutions for a work-around
to this via modification to the plugin code (see below and I hope I
incorporated it correctly :-). I would still like to know if it is
possible to configure per plugin threads via the pluginsvr.conf
configuration or other mechanism. This is for an ARS 7.5 / 7.6
environment.
Thanks,
Eric
Example singleton plugin:
--------------------------
package com.company.samples;
import java.util.List;
import com.bmc.arsys.api.ARException;
import com.bmc.arsys.api.Value;
import com.bmc.arsys.pluginsvr.*;
import com.bmc.arsys.pluginsvr.plugins.ARFilterAPIPluggable;
import com.bmc.arsys.pluginsvr.plugins.ARPluggable;
import com.bmc.arsys.pluginsvr.plugins.ARFilterAPIPlugin;
import com.bmc.arsys.pluginsvr.plugins.ARPluginContext;
import com.bmc.arsys.*;
import org.apache.log4j.Logger;
import com.company.someotherstuff*;
/**
* A class representing a singletone Plugin service.
* This will run as a java plugin under the Remedy Java plugin framework
* as a single instance instead of x instances as defined by arpluginsvr
coreThreads
*
* Useful when the plugin calls it's own management mechanism for work
distribution
* or a poller mechanism that should only be initialized once.
*
*/
public class MyPlugin extends ARFilterAPIPlugin {
// initiate logger
private static final Logger logger = Logger.getLogger(MyPlugin.class);
// for our singleton
private static MyPlugin myplug;
public MyPlugin() {};
/* Initialize the Remedy plugin */
public void initialize(ARPluginContext context) throws ARException {
logger.info("Started plugin init");
super.initialize(context);
/* check if it's already available, if not it's safe to init the
code for other stuff to do
*/
if(myplug == null){
myplug = getInstance();
//initialize the stuff we want to run outside of current
thread
initializeApp(context);
}
}
public void terminate(ARPluginContext context) throws ARException {
logger.info("Terminating context");
//cleanup routine here for graceful shutdown
super.terminate(context);
}
/* start it (the plugin) */
public static void main(String[] args) {
//'cause it's not ultimately useful at this juncture to accept
params at startup...
if(args!= null){
logger.warn("This plugin does not accept command line
messaging...");
}
}
/* initialize the meat of the plugin outside of the plugin
initialization thread
so the init process can complete and we aren't mucking things up
(according to the docs)
*/
private void initializeApp(ARPluginContext context) throws
ARException{
//class for storing config variables in memory instead of dealing
with an overload of i/o
ConfigParams cp = new ConfigParams();
try{
logger.info("calling init...");
cp.initialize(); // load config file parameters into mem
Thread t = new Thread(new Poller()); //thread our poller
mechanism
t.start(); //start the poller
} catch (RuntimeException rte){
terminate(context);
}
}
/* we aren't allowing filter api calls to this plugin because the
plugin
polls remedy asynchronously for all work to process
*/
public List<Value> filterAPICall(ARPluginContext context, List<Value>
in) throws ARException {
return null;
}
/* we aren't allowing event calls to this plugin
*/
public void onEvent(ARPluginContext context, int arg1) throws
ARException {
//do nothing
}
/* get an instance of this plugin */
private synchronized static MyPlugin getInstance()
{
if (myplug==null) myplug = new MyPlugin();
return plug;
}
}
Previous message:
Is it possible to configure individual plugins within a plugin server to
use
their own configuration for threads?
I.E. if there are multiple plugins within pluginsvr_config.xml, can each
have
their own designated number of threads or is it only possible that each
uses
the numCoreThreads setting for the overall plugin server? If they need
to be
different from the numCoreThreads designated by the pluginserver, is
there any
way to handle outside of running under a different plugin server
instance, and
if not, can multiple plugin servers be run on the same server with a
single
instance of Remedy?
(see below for example plugin server config)
Thanks in advance for any thoughts on this...
Kind Regards,
Eric Roys
GSSI
Verizon Business
Example plugin server config file...
<pluginsvr_config>
<port>myPort</port>
<regPortMapper>false</regPortMapper>
<encryptionPolicy>2</encryptionPolicy>
<publicKeyAlg>4</publicKeyAlg>
<publicKeyExpiry>86400</publicKeyExpiry>
<dataEncryptionAlg>1</dataEncryptionAlg>
<dataKeyExpiry>2700</dataKeyExpiry>
<numCoreThreads>5</numCoreThreads>
<numSelectorThreads>2</numSelectorThreads>
<workQueueMonitorLogInterval>0</workQueueMonitorLogInterval>
<workQueueTaskThreshold>5</workQueueTaskThreshold>
<plugins>
<plugin>
<name>PLUG00</name> <!-- start 10 threads ? -->
<pathelement type="location">some jar
location</pathelement>
<classname>some class name</classname>
</plugin>
<plugin>
<name>PLUG01</name> <!-- start 1 threads ? -->
<pathelement type="location">some jar
location</pathelement>
<classname>some class name</classname>
</plugin>
<plugin>
<name>PLUG02</name> <!-- start 5 threads ? -->
<pathelement type="location">some jar
location</pathelement>
<classname>some class name</classname>
</plugin>
<plugin>
<name>PLUG03</name> <!-- start 7 threads ?-->
<pathelement type="location">some jar
location</pathelement>
<classname>some class name</classname>
</plugin>
</plugins>
</pluginsvr_config>
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug11 www.wwrug.com ARSList: "Where the Answers Are"