Open topic with navigation

TIBCO GridServer® 7.1.0

# Container-managed Lifecycle

Services hosted in the GridServer environment are virtualized—provisioned dynamically on Engines at the behest of the GridServer Manager to satisfy demand. In this model, Service initialization and destruction happens automatically, but proper start-up and clean-up operations can be performed on the Service by registering the right methods to call on the Service to accomplish these tasks. The following simple class demonstrates a Service that connects to a hypothetical database:

    public class DBCalculator {
        public void initDBConnection(Properties connProps, int someVal) {
            _connection = new Connection(Properties props);
        }
        public Example calculate(String arg1, …) { … }
        public void close() {
            if (_connection != null) _connection.close();
        }
        private Connection _connection;
    }

When a class is registered as a Service Type, it is possible to specify in the ContainerBinding section of the registry page which methods are used for initialization and destruction of the Service. In this example, `initDBConnection` is specified as the “initMethod” field and `close` is specified in the “destroyMethod” field. Since `initDBConnection` takes two arguments, a Properties object and an `int`, the client-side proxy class has a constructor with the same argument list:

    public class DBCalculatorProxy {
        public DBCalculatorProxy(Properties connProps, int someVal) { … }
        …
    }

The “close” method is listed as the `destroyMethod`, and is exposed on the client-side proxy as a method named “destroy.”

Did you find this helpful?

Yes No
Great!
Thanks for taking the time to give us some feedback.
Sorry about that

Why wasn't this helpful? (check all that apply)

Could not find what I was looking for
Instructions confusing or unclear
Instructions did not work

Want to tell us more?

Please select at least one option or provide details about the issue!!

Error occurred while submitting feedback.

Error2 occurred while submitting feedback.

TIBCO GridServer®

Copyright © 2001-2022. TIBCO Software Inc. All Rights Reserved.