This component implements the actual freezing of an agent. Freezing is
accomplished by preventing the ThreadService from running certain
classes of components. The relevant object is the so-called
"consumer" of the ThreadService. For plugins, this is the plugin
itself. For other uses of the ThreadService, the "consumer" may be
different.
Generally, all plugins except those involved in the freeze process
are prevented from running, but this can be modified by rules
specified as plugin parameters. The rules are applied in this
order:
"allow " + FreezePlugin.class.getName()
first plugin parameter
second plugin parameter
etc.
"deny " + PluginBase.class.getName()
The form of the rule is one of the words, "deny" or "allow",
followed by a space followed by the name of the class or interface
that should be affected by the rule. The rule matches if it is
legal to assign the consumer to a variable of the type named in the
rule. This includes the class of the consumer itself, all
interfaces implemented by the consumer or their superinterfaces,
all superclasses of the consumer, and all interfaces implemented by
any superclass or their superinterfaces.
The first rule is built-in and cannot be overridden. It allows all
the freeze plugins to run while frozen. This is obviously necessary
to handle thawing a frozen society. The last rule is always added
and prevents all plugins that extend PluginBase from running except
those allowed by preceding rules. While it is possible to write a
component that behaves as a plugin but does not extend PluginBase,
this does not happen in practice.
The effect of this final rule can be nullified by including rules
(as plugin parameters) that specifically allow individual plugins.
Indeed, the whole class of plugins extending PluginBase could be
allowed. It is possible to prevent anything from being frozen in an
agent by making the first plugin parameter be "allow
java.lang.Object". Since every class extends java.lang.Object, this
will allow every class to run.
NOTE: This is part of the older mechanism for freezing the society. The
current mechanism uses FreezeServlet located on every agent in the society,
and depends on some external process to tell all agents to freeze. This older
mechanism has not been removed so that people can continue to use a single servlet
to freeze the entire society, but the FreezeServlet mechanism is preferred now.
|