OIM 11g : Multi-thread approach for writing custom scheduled job
Posted
by Saravanan V S
on Oracle Blogs
See other posts from Oracle Blogs
or by Saravanan V S
Published on Thu, 29 Nov 2012 10:38:38 +0000
Indexed on
2012/11/29
11:15 UTC
Read the original article
Hit count: 311
/Oracle
In this post I have shared my experience of designing and developing an OIM schedule job that uses multi threaded approach for updating data in OIM using APIs. I have used thread pool (in particular fixed thread pool) pattern in developing the OIM schedule job. The thread pooling pattern has noted advantages compared to thread per task approach. I have listed few of the advantage here
· Threads are reused
· Creation and tear-down cost of thread is reduced
· Task execution latency is reduced
· Improved performance
· Controlled and efficient management of memory and resources used by threads
More about java thread pool http://docs.oracle.com/javase/tutorial/essential/concurrency/pools.html
The following diagram depicts the high-level architectural diagram of the schedule job that process input from a flat file to update OIM process form data using fixed thread pool approach
The custom scheduled job shared in this post is developed to meet following requirement
1) Need to process a CSV extract that contains identity, account identifying key and list of data to be updated on an existing OIM resource account.
2) CSV file can contain data for multiple resources configured in OIM
3) List of attribute to update and mapping between CSV column to OIM fields may vary between resources
The following are three Java class developed for this requirement (I have given only prototype of the code that explains how to use thread pools in schedule task)
CustomScheduler.java - Implementation of TaskSupport class that reads and passes the parameters configured on the schedule job to Thread Executor class.
package com.oracle.oim.scheduler; import java.util.HashMap;
public class CustomScheduler extends TaskSupport { public void execute(HashMap options) throws Exception { /* Read Schedule Job Parameters */
} public HashMap getAttributes() { return null; } public void setAttributes() { } } |
MultiThreadDataRecon.java – Helper class that reads data from input file, initialize the thread executor and builds the task queue.
package com.oracle.oim.bo; import <required file IO classes>;
private int noOfThreads;
public MetaDataRecon(<required params>, int noOfThreads) {
/**
private void init() throws Exception { try { // Initialize CSV file reader API objects
if (noOfThreads > 1) {
/* Initialize TaskProcess clas s which will be executing task
TaskProcessor.initializeConfig(params);
/**
public void reconcile() throws Exception {
/**
private void processRow(String row) {
} } |
TaskProcessor.java – Implementation of “Runnable” interface that executes the required business logic to update data in OIM.
package com.oracle.oim.bo; import <required APIs> class TaskProcessor implements Runnable { //Initialize required member variables
/*
/*
/**
private void processData() { try{ //Find the user in OIM using the identity matching key value from CSV
} } |
© Oracle Blogs or respective owner