Subash Murugan

Greenhorn
+ Follow
since Mar 26, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Subash Murugan

Hi All,

I have a question regarding synchronizing Array List. I am using an ArayList in a multi threaded environment with Callable interface. I pass an Arraylist object to the Callable method where all the child threads add an entry into the arraylist.
I don't use the arraylist to Iterate anywhere in the Child thread classes. Should I need to synchronize the Arraylist still even if I do only add into that?

Snippet below, please help

main Class
...
ArrayList<String> arrList = new ArrayList<String>();
ImplCallable implCallable = new ImplCallable (arrList);
.
.
.
ImplCallable Class

ImplCallable (ArrayList<String> arrList)
{
this.arrList = arrList;
}
call()
{
.
.
.
.
synchronized(arrList )
{
arrList.add(addString);
}

}

Regards
Subash
Thanks Shashi & Sadanand,

I got the mail from Oracle to process the certificate Kit as well, hopefully i will get it physically in hands soon.
All the best to all guys who cleared the exam as well

Cheers
Subash
Decrementing the counter delightfully as I got the most awaited today that I have cleared the exam. Cant believe that am an architect now

Exam details :
Part 1 - Aug 30th
Part 2 - Sep 23rd
Part 3 - Sep 30th

Got the results on 20th Dec

Counter stays at 19 now

regards
Subash
Yes Nilesh & Sadanand,

I got the most awaited mail today that I have passed the exam. Really happy to see the result after such a long wait close to 3 months.
I should thank this thread as it helps out all along through the journey.

Thanks all kind hearted people.

regards
Suabsh
Hi,

My Scoreboard in Oracle Certview & Pearson Vue shows 'PASS' in Part 2, however it shows as 'TAKEN' for Part 3. Not sure its some technical issue with the System as not properly updated the status of Part 3 or Part 3 will be Scored separately only.. Should I need to mail Oracle and get it Clarified ? or is it possible to FAIL in Part 3 alone ? little confused now..

Regards
Subash
Hi Francesco,

Congrats dude !!

Can you please let us know when did you take the exam and submit your assignment ?

Cheers
Subash
13 years ago
Hi Ganesh / Akram,

I bought my assignment through Pearson Vue account and am planning to submit my assignment by this weekend as i have some final stuff to complete.
Is it possible to fix an appointment immediately after I uploaded the assignment? or do I need to wait for sometime?
As the dates are nearing for the Oct 1st deadline many would be queuing up to book a slot if it gets delayed after i uploaded the assignment it will be difficult for me to book for 3rd part before OCt 1st

regards
Subash
I already sent mail to [email protected] regarding this, will post once I get the updates from them.

regards
Subash
Hi Krzysztof Grajek,

Thanks for the reply, I indeed tried to book a slot.

I completed till the last step, selected course, selected slot & time and even provided credit card details.
But till then Pearson site dint block me anywhere.
I stopped before the last submit as am not sure am allowed to do so or not. I don't want to end up after a successful registration and face any issues at later point of time...

So it is only checking when we submit after even we provided the credit card details etc ?

regards
Subash
Hi All,

I have cleared the Part 1 of architect certification and I downloaded the assignment for part 2 as well.

Currently am working on the assignments and planning to upload around 20 -25th of september and take the final part 3 before 30th of september to ensure I complete everything before 30th (Obviously to get away with the mandatory training course from Oct 1st).

But am quite skeptical about the slots as I'm afraid many people would rush in at the last minute to take up various exams and that too during the last 10 days.
So if i wait for booking the slot for part 3 till I upload my assignments I might possibly not getting a slot in the last week.

Is it possible to book a slot upfront before uploading the assignment and ensure before taking up the final part after i uploaded ?

For instance if i book now itself a slot for 27th of sep for my last part 3 exam and submit the assignment on 26th, is it allowed ?

Because I see in the Oracle site for the part 3 description they mentioned as
"Your assignment must be submitted before you can register for the essay."

But i tried to book a slot through pearson site it dint block me anywhere like checking the part 2 status or something.

If i do so will be in trouble at later time or getting the certification result later?

Please clarify.

Regards
Subash
Hi Ranchers,

Am preparing for SCEA and happened to see the following qn in one site,

You are creating a web application for an online product ordering system. You have decided to use connection pooling to reduce load on the databases. Since you have many databases, you want to create one pool instance of the ConnectionPool class for each database. Depending on what is requested, you may have to connect to a variable number of databases. What pattern should you use?

a) Abstract factory b) Factory Method
c) Builder d) Prototype
e) Singleton

Where answer is given as E, and the reason given "The Singleton doesn't just create a single instance it can also be used to create a variable number of instances of a class. "
Am just wondering its given correctly or not? can someone please clarify?

Regards
Subash
Hi Partha,

Congratulations & Thanks for sharing your experience, can you share for the below qns as well?

how about questions on web tier components ? do we need to know all the tags and their usages in JSTL?
And how did you prepare for Section 6: Applicability of Java EE Technology ? is SOA using Java Web Services should do for this?

Regards
Subash
Hi am not able to attach my file am giving my code here, please bear with the size and have a look, its a stand alone java pgm, can anyone please try in eclipse and figure out the mistakes am doing here?

package com.ebay.swat.jprofiler.view;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;

import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnLabelProvider;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.ITreeViewerListener;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.jface.viewers.TreeExpansionEvent;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;



/**
* A simple TreeViewer to demonstrate usage
*
* @author Tom Schindl <[email protected]>
*
*/
public class TestPgm2 {

private int listIndex = -1;
private boolean positionChildFlag = false;
private ArrayList<ProfilerInputModel> threadDetailsList = new ArrayList();
private String profilerInputFile = "";
File profilerFileObj = null;
BufferedReader readBuffer = null;
private TreeViewer v = null;

public TestPgm2(final Shell shell) {
//Button b = new Button(shell,SWT.PUSH);
//b.setText("Remove column");
v = new TreeViewer(shell, SWT.BORDER
| SWT.FULL_SELECTION);
v.getTree().setLinesVisible(true);
v.getTree().setHeaderVisible(true);


//
// TreeViewerFocusCellManager focusCellManager = new TreeViewerFocusCellManager(v,new FocusCellOwnerDrawHighlighter(v));
// ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(v) {
// protected boolean isEditorActivationEvent(
// ColumnViewerEditorActivationEvent event) {
// return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
// || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
// || (event.eventType == ColumnViewerEditorActivationEvent.KEY_PRESSED && event.keyCode == SWT.CR)
// || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
// }
// };
//
// TreeViewerEditor.create(v, focusCellManager, actSupport, ColumnViewerEditor.TABBING_HORIZONTAL
// | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
// | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);

final TextCellEditor textCellEditor = new TextCellEditor(v.getTree());

TreeViewerColumn column = new TreeViewerColumn(v, SWT.NONE);
column.getColumn().setWidth(200);
column.getColumn().setMoveable(true);
column.getColumn().setText("Thread Name");

column.setLabelProvider(new ColumnLabelProvider() {

public String getText(Object element) {
return ((ProfilerInputModel) element).threadDetails.getThreadName();
}

});
column.setEditingSupport(new EditingSupport(v) {
protected boolean canEdit(Object element) {
return true;
}

protected CellEditor getCellEditor(Object element) {
return textCellEditor;

}

protected Object getValue(Object element) {
return ((ProfilerInputModel) element).threadDetails.getThreadName() + "";
}

protected void setValue(Object element, Object value) {
((ProfilerInputModel) element).threadDetails.setThreadName(value.toString());
v.update(element, null);
}
});

column = new TreeViewerColumn(v, SWT.NONE);
column.getColumn().setWidth(200);
column.getColumn().setMoveable(true);
column.getColumn().setText("Method id");
column.setLabelProvider(new ColumnLabelProvider() {

public String getText(Object element) {
return ((ProfilerInputModel) element).threadDetails.getThreadId();
}

});
column.setEditingSupport(new EditingSupport(v) {
protected boolean canEdit(Object element) {
return true;
}

protected CellEditor getCellEditor(Object element) {
return textCellEditor;
}

protected Object getValue(Object element) {
return ((ProfilerInputModel) element).threadDetails.getThreadId() + "";
}

protected void setValue(Object element, Object value) {
((ProfilerInputModel) element).threadDetails.setThreadId(value.toString());
v.update(element, null);
}
});

column = new TreeViewerColumn(v, SWT.NONE);
column.getColumn().setWidth(200);
column.getColumn().setMoveable(true);
column.getColumn().setText("Parent Id");
column.setLabelProvider(new ColumnLabelProvider() {

public String getText(Object element) {
return ((ProfilerInputModel) element).threadDetails.getParentId();
}

});
column.setEditingSupport(new EditingSupport(v) {
protected boolean canEdit(Object element) {
return true;
}
protected CellEditor getCellEditor(Object element) {
return textCellEditor;
}

protected Object getValue(Object element) {
return ((ProfilerInputModel) element).threadDetails.getParentId() + "";
}

protected void setValue(Object element, Object value) {
((ProfilerInputModel) element).threadDetails.setParentId(value.toString());
v.update(element, null);
}
});



column = new TreeViewerColumn(v, SWT.NONE);
column.getColumn().setWidth(200);
column.getColumn().setMoveable(true);
column.getColumn().setText("Method Name");
column.setLabelProvider(new ColumnLabelProvider() {

public String getText(Object element) {
return ((ProfilerInputModel) element).threadDetails.getMethodName();
}

});
column.setEditingSupport(new EditingSupport(v) {
protected boolean canEdit(Object element) {
return true;
}

protected CellEditor getCellEditor(Object element) {
return textCellEditor;
}

protected Object getValue(Object element) {
return ((ProfilerInputModel) element).threadDetails.getMethodName() + "";
}

protected void setValue(Object element, Object value) {
((ProfilerInputModel) element).threadDetails.setMethodName(value.toString());
v.update(element, null);
}
});

column = new TreeViewerColumn(v, SWT.NONE);
column.getColumn().setWidth(200);
column.getColumn().setMoveable(true);
column.getColumn().setText("Execution Time");
column.setLabelProvider(new ColumnLabelProvider() {

public String getText(Object element) {
return ((ProfilerInputModel) element).threadDetails.getExecutionTime();
}

});
column.setEditingSupport(new EditingSupport(v) {
protected boolean canEdit(Object element) {
return true;
}

protected CellEditor getCellEditor(Object element) {
return textCellEditor;
}

protected Object getValue(Object element) {
return ((ProfilerInputModel) element).threadDetails.getExecutionTime() + "";
}

protected void setValue(Object element, Object value) {
((ProfilerInputModel) element).threadDetails.setExecutionTime(value.toString());
v.update(element, null);
}
});


v.setContentProvider(new MyProfileContentProvider());
v.addTreeListener(new ITreeViewerListener(){


public void treeExpanded(TreeExpansionEvent e) {
String strLine ="";
readBuffer = null;
try {
readBuffer = new BufferedReader(new FileReader(profilerFileObj));

System.out.println("Element "+((ProfilerInputModel)e.getElement()).threadName);

String threadName = "";
String threadMethodId = "";
String threadParentId = "";
int threadIndex = -1;
ProfilerInputModel element = new ProfilerInputModel();
ProfilerInputModel element1 = (ProfilerInputModel)e.getElement();
boolean entryFlag = false;

threadName = ((ProfilerInputModel)e.getElement()).threadName;
threadMethodId = ((ProfilerInputModel)e.getElement()).threadDetails.getThreadId();
threadParentId = ((ProfilerInputModel)e.getElement()).threadDetails.getParentId();
if(threadParentId.equals("-1"))
{
threadParentId = "0";
entryFlag = true;
}

System.out.println("test 1");
for(int i=0;i<threadDetailsList.size();i++)
{
System.out.println("test 2");
if(threadDetailsList.get(i).threadName.equals(threadName))
{
threadIndex = i;
break;
}
}

while((strLine = readBuffer.readLine())!=null)
{

String[] threadInfo = null;
threadInfo = strLine.split("#");
if(threadName.equals(threadInfo[0])&& threadParentId.equals(threadInfo[2]))
{
System.out.println("test 3"+threadParentId);
ProfilerInputModel profilerInputModel = new ProfilerInputModel();
ThreadDetails td = new ThreadDetails();
td.setThreadName(threadInfo[0]);
profilerInputModel.threadName=threadInfo[0];
td.setThreadId(threadInfo[1]);
td.setParentId(threadInfo[2]);
td.setMethodName(threadInfo[3]);
td.setExecutionTime(threadInfo[4]);
profilerInputModel.threadDetails = td;
if(entryFlag)
{
entryFlag = false;
threadDetailsList.get(threadIndex).profileInputModelChildList.remove(0);
}
threadDetailsList.get(threadIndex).profileInputModelChildList.add(profilerInputModel);
//element1.profileInputModelChildList.add(profilerInputModel);
element1.updateChildProfile(profilerInputModel);
}

}

//element.profileInputModelChildList = threadDetailsList;
//v.setInput(element);
//v.expandAll();
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}

public void treeCollapsed(TreeExpansionEvent e) {
System.out.println("Testing doulbe click");
}

});

v.setUseHashlookup(true);
v.setInput(createProfileInputModel());
}


public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
new TestPgm2(shell);
shell.open();

while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}

display.dispose();
}


private class MyProfileContentProvider implements ITreeContentProvider, ITreeViewerListener
{
protected TreeViewer viewer;
public Object[] getElements(Object inputElement) {
System.out.println("calling..1");
return ((ProfilerInputModel) inputElement).profileInputModelChildList.toArray();
}

public void dispose() {
}

public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {

if (newInput != null)
((ProfilerInputModel)newInput).addListener(this);
if (oldInput != null)
((ProfilerInputModel) oldInput).removeListener(this);

System.out.println("Input changed: old=" + oldInput + ", new=" + newInput);
// this.getElements(newInput);
this.viewer = (TreeViewer)viewer;
//viewer.refresh();
// viewer.addTreeListener(

}

public Object[] getChildren(Object parentElement) {
System.out.println("calling..2");
return getElements(parentElement);
}

public Object getParent(Object element) {
System.out.println("calling..3");
if (element == null) {

return null;
}
return ((ProfilerInputModel) element);
}

public boolean hasChildren(Object element) {
System.out.println("calling..");
return (((ProfilerInputModel) element).profileInputModelChildList.size()>0) ;
}

@Override
public void treeCollapsed(TreeExpansionEvent event) {


// TODO Auto-generated method stub

}

@Override
public void treeExpanded(TreeExpansionEvent event) {
System.out.println("*********** Called here..");
Object profilerInputModel = ((ProfilerInputModel)event.getElement());
viewer.refresh(profilerInputModel, true);

// TODO Auto-generated method stub

}

}

public class ProfilerInputModel
{
////public ProfilerInputModel rootProfilerInputModel;
//public ProfilerInputModel childProfilerInputModel;

//public ArrayList child = new ArrayList();
ArrayList<ProfilerInputModel> profileInputModelChildList = new ArrayList();
ThreadDetails threadDetails ;
protected ITreeViewerListener listener = null;

public ProfilerInputModel(String threadName,String methodName, String childThread)
{
this.threadName = threadName;
this.methodName = methodName;
this.childThread = childThread;
}
public ProfilerInputModel(String profilerFile)
{
this.profilerFile = profilerFile;
}
public ProfilerInputModel(ProfilerInputModel rootProfilerInputModel)
{
//this.rootProfilerInputModel = rootProfilerInputModel;
}
public ProfilerInputModel()
{

}
public void addListener(ITreeViewerListener listener)
{
this.listener = listener;
}

/*
* @see IDeltaListener#remove(DeltaEvent)
*/
public void removeListener(ITreeViewerListener listener)
{
this.listener = null;
}

public void updateChildProfile(ProfilerInputModel profilerInputModel)
{
profileInputModelChildList.add(profilerInputModel);
}

public String profilerFile = "C:/smurugan/jprofiler/profileDetails.txt";

public String threadName ="thread 1";

public String methodName ="TestPgm.testCall";

public String childThread ="0";


}

public class ThreadDetails
{
public String threadName;
public String getThreadName() {
return threadName;
}
public void setThreadName(String threadName) {
this.threadName = threadName;
}
public String getThreadId() {
return threadId;
}
public void setThreadId(String threadId) {
this.threadId = threadId;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getMethodName() {
return methodName;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
}
public String getExecutionTime() {
return executionTime;
}
public void setExecutionTime(String executionTime) {
this.executionTime = executionTime;
}
public String threadId;
public String parentId;
public String methodName;
public String executionTime;
}



private ProfilerInputModel createProfileInputModel() {

//ProfilerInputModel root = new ProfilerInputModel("thread 2","Test.test","1");
ProfilerInputModel root = new ProfilerInputModel();
//root.profileInputModelChildList = parseProfilerFile("C:/smurugan/jprofiler/profileDetails.txt");
root.profileInputModelChildList = populateProfilerModel("C:/smurugan/jprofiler/profileDetails.txt");

// for (int i = 1; i < 10; i++) {
// tmp = new ProfilerInputModel("thread "+i,"Test.test",String.valueOf(i));
// root.threadDetailsList.add(tmp);
// for (int j = 1; j < i; j++) {
// subItem = new ProfilerInputModel("thread "+j,"Test.test",String.valueOf(j));
// subItem.threadDetailsList.add(new ProfilerInputModel("thread "+j,"Test.test",String.valueOf(j)));
// tmp.threadDetailsList.add(subItem);
// }
// }

return root;
}

private ArrayList<ProfilerInputModel> populateProfilerModel(String profilerInputFile)
{
this.profilerInputFile = profilerInputFile;

try {
profilerFileObj = new File(profilerInputFile);
readBuffer = new BufferedReader(new FileReader(profilerFileObj));
String strLine;
int tempCounter = 0;
while((strLine = readBuffer.readLine())!=null)
{
System.out.println("tempCounter "+ ++tempCounter);
ProfilerInputModel profilerInputModel = null;



String[] threadInfo = strLine.split("#");
if(threadInfo[2].equals("-1"))
{
profilerInputModel = new ProfilerInputModel();
ThreadDetails td = new ThreadDetails();
td.setThreadName(threadInfo[0]);
profilerInputModel.threadName=threadInfo[0];
td.setThreadId(threadInfo[1]);
td.setParentId(threadInfo[2]);
td.setMethodName(threadInfo[3]);
td.setExecutionTime(threadInfo[4]);
profilerInputModel.threadDetails = td;

ProfilerInputModel tmpProfilerInputModel = new ProfilerInputModel();
ThreadDetails tds = new ThreadDetails();
tds.setThreadName("temp");
tmpProfilerInputModel.threadName="temp";
tds.setThreadId("temp");
tds.setParentId("temp");
tds.setMethodName("temp");
tds.setExecutionTime("temp");
tmpProfilerInputModel.threadDetails = td;

profilerInputModel.profileInputModelChildList.add(0,tmpProfilerInputModel);
threadDetailsList.add(profilerInputModel);
}
}
return threadDetailsList;
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}

}



}
16 years ago
Hi Folks,

I am new to JFace and creating an application in TreeViewer. While expanding in the tree I wanted to update teh input field by reading the file again. I was trying to set the input bu the UI is still showing with teh old object. In Sys out I see the object is updated though, but the UI is not getting updated. I tried using the viewer.setInput again in the treeExpanded(TreeExpansionEvent e) listner to call the inputChanged method but the UI is refreshed and it shows the initial UI.

Can someone please help me out where am missing something?

I attached the java pgm here,

and the input file profileDetails.txt is having values like,

1#1#0#com.TestMe$<init>#0
1#2#0#com.TestMe$<init>#0
1#0#-1#com.TestMe$main#0
10#2#1#com.TestMe$t2#5000
11#2#1#com.TestMe$t2#5000
1#2#2#com.TestMe$<init>#0
1#0#1#com.TestMe$main#0
10#3#1#com.TestMe$t3#0
10#1#0#com.TestMe$t1#5000
10#0#-1#com.TestMe$run#5000
1#2#3#com.TestMe$<init>#0
1#0#2#com.TestMe$main#0
11#3#1#com.TestMe$t3#0
11#1#0#com.TestMe$t1#5000
11#0#-1#com.TestMe$run#5000


Please help me out in this..

Thanks a lot

Regards
Subash
16 years ago