wmarbut
wmarbut

Reputation: 4685

Jython WLST using python threading module (Weblogic 10)

Environment

Goal

Restart all managed instances with all clusters in a rolling restart fashion. Would like the different clusters to restart concurrently

Question

Is there a way to use Jython's threading module to do multiple WLST actions at the same time?

Attempted Approach

In one script I have classes for both cluster and server instance. A cluster has a list of server instances. There is a method on the cluster object to loop through its list of servers and restart them one by one if the cluster is healthy. I have tried passing this method into a thread like so:

Thread(target=lambda: cluster.managedRestart()).start()

But I receive an error TypeError: can't set arbitrary attribute in java instance: target

Ideas

Break out the managed restart code into a seperate file and use execfile() to call it from within a thread

Does anyone else have any ideas / suggestions / experience?

Upvotes: 4

Views: 1743

Answers (1)

Mani
Mani

Reputation: 965

I don't think threads are to be used explicitly to start the managed servers in parallel. Following code will start all the clusters in parallel. block='false' will not block the control at the start command which means the start command will be issued and immediately the next command which is starting another cluster is executed. Therefore all the clusters can be started in parallel. Same goes with shutdown command as well.

connect(username='weblogic', password='weblogic1', url='t3://localhost:7001')
clusterList = ls('/Clusters', returnMap='true')
for cluster in clusterList :
    start(cluster, 'Cluster', block='false')

Upvotes: 4

Related Questions