Thursday, September 29, 2011

WebLogic WorkManager for Multi-threading

WebLogic's WorkManager provides a self-tuned ThreadPool to enable Multi-Threading.

Define a WorkManager either in WLS console or in web.xml as below.


In weblogic-application.xml, you can configure the ThreadPool Size


Java Code

        try {
InitialContext ic = new InitialContext();
WorkManager workManager = (WorkManager)ic.lookup("java:comp/env/wm/MyWorkManager");
List workItemList=new ArrayList();

for(int i=0;i<10;i++){
WorkItem workItem1 = startWorkItem(my,i,"OSMM");

//run the work items in parallel; don't wait
//workManager.waitForAll(workItemList, WorkManager.IMMEDIATE);

    public WorkItem startWorkItem(WorkManager workManager, final int count, final String wmName) throws Exception{
WorkItem workItem10 = workManager.schedule(new Work() {
public void run() {
try {
System.out.println("Current Count ["+count+"] : wmName ["+wmName+"]ThreadName Is: "+Thread.currentThread().getName()+"##Priroty="+Thread.currentThread().getPriority());
} catch (Exception e) {

public void release() {

public boolean isDaemon() {
return false;
}); //End of Schedule
return workItem10;


PLSQL:Encryption Decryption DBMS_CRYPTO

set serveroutput on

LC$Source VARCHAR2(19) := 'Music is the best!';
LR$Source RAW(128) := utl_raw.cast_to_raw(LC$Source);
LR$Key RAW(128) := utl_raw.cast_to_raw('FrankZappa');
LR$Crypted RAW(2048);
LR$Decrypted RAW(2048);


dbms_output.put_line('Source string : ' || LC$Source);

LR$Crypted := dbms_crypto.encrypt(LR$Source,
dbms_crypto.des_cbc_pkcs5, LR$Key);

dbms_output.put_line('Encrypted raw : ' ||

LR$Decrypted := dbms_crypto.decrypt(src => LR$Crypted,
typ => dbms_crypto.des_cbc_pkcs5, key => LR$Key);

dbms_output.put_line('Decrypted string : ' ||