Thread doubled output
Hi,
For the purpose of my work, I am trying to store the output that is produced by StreamRedirectThread.java into a vector as shown in the code below. The output of the thread code is ok and the output printed is the numbers from 0 to 5.
When I try to print out that vector, the output is not as the same as it is printed in the StreamRedirectThread.java program. For example if the output form the program prints out the numbers form 0 to 5, as I said before, the vector output is doubled in size and prints:
index = 0 content=0
index = 1 content=
index = 2 content=1
index = 3 content=
index = 4 content=2
index = 5 content=
index = 6 content=3
index = 7 content=
index = 8 content=4
index = 9 content=
index = 10 content=5
index = 11 content=
Can anybody advice me what to do about it. I tried but couldn't fix it. The code of StreamRedirectThread.java is as
Here is the Thread Code: Thanks
import java.io.*;*
*import java.util.*;
import com.sun.jdi.*;*
*import com.sun.jdi.request.*;
import com.sun.jdi.event.*;*
*import com.sun.jdi.connect.*;
class StreamRedirectThread extends Thread {
private final Reader in;
private final Writer out;
private static Vector outvector = new Vector(0); // victor of objects that contains output result
private static final int BUFFER_SIZE = 2048;
* Set up.
* @param name Name of the thread
* @param in Stream to copy from
* @param out Stream to copy to
StreamRedirectThread(String name, InputStream in, OutputStream out) {
super(name);
this.in = new InputStreamReader(in);
this.out = new OutputStreamWriter(out);
setPriority(Thread.MAX_PRIORITY-1);
public void run() {
try {
char[] cbuf = new char[BUFFER_SIZE];
int count;
while ((count = in.read(cbuf, 0, BUFFER_SIZE)) >= 0) {
//out.write(cbuf,0,count);
String s = new String(cbuf,0,count);
if (!(s.equals(null)))
TemplateApp.vv.addElement(s);
outvector.addElement(s); out.write(s);
out.flush();
} catch(IOException exc) {
System.err.println("Child I/O Transfer - " + exc);
public synchronized static Vector getOutVector()
return outvector ;
}Thanks a lot for help
Iman_S wrote:
while ((count = in.read(cbuf, 0, BUFFER_SIZE)) >= 0) {
String s = new String(cbuf,0,count);
if (!(s.equals(null)))
TemplateApp.vv.addElement(s);
outvector.addElement(s); out.write(s);
out.flush();
}I've reposted and properly indented this code to help you understand what's going on. I have many problems with this:
1. s.equals(null) is always false if equals is properly implemented. This is because, if a.equals(b), b.equals(a) must be true due to the symmetry constraint of equals() -- see here: [http://java.sun.com/developer/Books/effectivejava/Chapter3.pdf]. If s.equals(null) were true, then null.equals(s) would have to be true, which is obviously incorrect as a NullPointerException would have been thrown. Use s == null to compare an Object reference with a null reference, and use s.isEmpty() or s.length() == 0 to decide whether a String has characters.
2. Always use opening and closing braces ( { } ) with an if block. I'm guessing you thought that the "outvector.addElement(s)" statement was IN the if block, but it in fact wasn't. Always be explicit.
3. Don't do anything that you're doing inside that while loop if count == 0. in.read() can return 0 any time it wants, which means that it didn't read any characters. However, you are using that blank output without caring. I'm guessing the s.equals(null) line was meant to weed that out, but as I said, that will always be false. Moreover, new String( new char[0] ) doesn't give you a null reference, it gives you a new String with no characters.
I would suggest something more like this:
while ((count = in.read(cbuf, 0, BUFFER_SIZE)) >= 0) {
if ( count == 0 ) {
continue;
String s = new String(cbuf,0,count);
TemplateApp.vv.addElement(s);
outvector.addElement(s);
out.write(s);
out.flush();
Edit I should note that this isn't likely your problem. As Peter said, it does look like you are basically adding newline characters to outvector (if you're sending your data with println, this is to be expected!). Also, I was a bit hasty in saying that InputStream returns 0 "whenever it wants." This isn't typical behaviour, but it should be handled nonetheless.
Remember that the whole idea of quantifying a Stream like you're doing (adding the content piece by piece to a vector) doesn't make much sense. You really don't have control over how much data arrives at once, etc. This usually depends on the implementation of the streams that are receiving and sending the data. So, while if I sent this string over a socket:
"Hello brave new world"
And received it with a large buffer, it could be read by your in.read() function in these pieces: "Hello ", "brave ", "new ", "world", but that would be completely coincidental. It's more likely it would arrive in random pieces, and most likely in one big piece, requiring only one in.read().
Edited by: endasil on 22-Jul-2008 3:59 PM
Similar Messages
-
StringBuffer when used with multi thread show output in UnSynchronize way.
below is my code :-
public class Two implements Runnable
//thread safe
static StringBuffer builder=new StringBuffer("output:1");
Two(StringBuffer builder)
this.builder=builder;
public void run()
System.out.println("Printed by "+Thread.currentThread().getName()+" : "+builder.append(" output:5"));
public static void main(String s[])
builder.append(" output:2");
Two d1=new Two(builder);
Thread t1=new Thread(d1);
Thread t2=new Thread(d1);
Thread t3=new Thread(d1);
t1.start();
t2.start();
t3.start();
builder.append(" output:3");
builder.append(" output:4");
System.out.println("Printed by "+Thread.currentThread().getName()+" : "+builder);
when the program is executed it show different output in corresponds to the order of call and it is not showing thread saftey.thanks tolls ,
below is my output : -
first time when i run the progra"_
Printed by Thread-1 : output:1 output:2 output:5 output:5 output:5
Printed by Thread-0 : output:1 output:2 output:5
Printed by main : output:1 output:2 output:5 output:5 output:5 output:3 output:4
Printed by Thread-2 : output:1 output:2 output:5 output:5
second time when i run the program_
Printed by Thread-0 : output:1 output:2 output:5
Printed by Thread-2 : output:1 output:2 output:5 output:5 output:3 output:4 output:5
Printed by Thread-1 : output:1 output:2 output:5 output:5
Printed by main : output:1 output:2 output:5 output:5 output:3 output:4
see the order of output. there is no synchronization among threads . Where as StringBuffer is thread safe but the order of output is different at each time. My question is just that
how to achieve synchronization among threads. -
This is odd ! We are using WLS 6.1 with servlets and JSPs, no EJB. Sometimes
we use System.out.println() for debugging in a JSP and once in a while we see
the debug message being output twice. We have a proxy server for our intranet
and when we disable that from the browser (IE 5.5) the double output goes away.
What is puzzling abou this is that the double output alos goes away if we run
the same JSP in Tomcat ... regardless of whether or not we enable the proxy server
in our browsers !
Any ideas or similar experiences ?
TIA !!
eja
sorry guys,
I asked a stupid question. realised it almost as soon as I posted it.
Ta,
R -
Reroute usb power to double output?
I'm curious if it is possible to reroute the power from 1 USB 2.0 port to the other one...? I have a WD ext HD and the power from one is not enough to get the little thing going. This is very frustrating...! There is the option of adding a Y cable splitting the USB into both ports. I would like to just take the power away from one and add it to the other. Is this possible?
If it is... How might one be able to do this?
Powerbook G4 Mac OS X (10.3.9) SickUnless you know how to manipulate the data paths and soldering job on the logic board...probably not.
Buy a firewire drive and your problem is solved. -
Double click in ALV tree output????
Hi all,
I am able to display output in tree format. But I want to add the double click functionality to some of the fields in output. Means if I double click on some value in output tree, it should call some transaction. Please help me with this issue of double clicking.
Please tell how to handle events in this report tree display.
For the following code its displaying output in tree format and in right way. But i need to add double click functionality to this.
So provide me some sample program for this one....
* create hierarchy
CALL METHOD tree1->set_table_for_first_display
EXPORTING
it_list_commentary = lt_list_commentary
i_background_id = 'ALV_BACKGROUND'
i_save = 'A'
is_variant = ls_variant
CHANGING
it_sort = gt_sort[]
it_outtab = itab_outtab
it_fieldcatalog = t_fieldcat. "gt_fieldcatalog.
* expand first level
CALL METHOD tree1->expand_tree
EXPORTING
i_level = 1.
* optimize column-width
CALL METHOD tree1->column_optimize
EXPORTING
i_start_column = tree1->c_hierarchy_column_name
i_end_column = tree1->c_hierarchy_column_name.
In grid ALV we can have double cilck functionality using code:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'USER_COMMAND'
is_layout = ls_layout
it_fieldcat = gt_fc[]
Here we can write subroutine for USER_COMMAND and handle the double click evenet. But tell me how to provide this in tree ALV.
<REMOVED BY MODERATOR>
Regards,
Sachin
Edited by: Alvaro Tejada Galindo on Feb 14, 2008 1:47 PMHello Sachin
The following sample report ZUS_SDN_ALV_TREE_DEMO demonstrates the crucial parts for double-click event handling (nodes & items) in ALV trees.
*& Report ZUS_SDN_ALV_TREE_DEMO
*& Thread: double click in ALV tree output????
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="742412"></a>
REPORT zus_sdn_alv_tree_demo.
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
TYPE-POOLS: abap.
TYPES: BEGIN OF ty_s_outtab.
INCLUDE TYPE knvv AS data.
TYPES: nkey TYPE lvc_nkey.
TYPES: parent_key TYPE lvc_nkey.
TYPES: END OF ty_s_outtab.
TYPES: ty_t_outtab TYPE STANDARD TABLE OF ty_s_outtab
WITH DEFAULT KEY.
DATA: gt_outtab TYPE ty_t_outtab.
DATA:
gd_okcode TYPE ui_func,
gd_repid TYPE syst-repid,
gt_fcat TYPE lvc_t_fcat,
gs_layout TYPE lvc_s_layo,
gs_variant TYPE disvariant,
go_docking TYPE REF TO cl_gui_docking_container,
go_tree TYPE REF TO cl_gui_alv_tree.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_node_double_click
FOR EVENT node_double_click OF cl_gui_alv_tree
IMPORTING node_key,
handle_item_double_click
FOR EVENT item_double_click OF cl_gui_alv_tree
IMPORTING node_key
fieldname.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_node_double_click.
message 'Event=Double-Click on Node' type 'I'.
call transaction 'XD03'.
ENDMETHOD. "handle_node_double_click
METHOD handle_item_double_click.
message 'Event=Double-Click on Item' type 'I'.
call transaction 'VA03'.
ENDMETHOD. "handle_item_double_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
PERFORM init_controls.
gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid
dynnr = '0100'
* container =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
lifetime_dynpro_dynpro_link = 3
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL SCREEN '0100'.
** NOTE: no elements on screen
** PROCESS BEFORE OUTPUT.
** MODULE STATUS_0100.
** PROCESS AFTER INPUT.
** MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
TRANSLATE gd_okcode TO UPPER CASE.
CASE gd_okcode.
WHEN 'BACK' OR
'EXIT' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN 'REFRESH'.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form init_controls
* text
* --> p1 text
* <-- p2 text
FORM init_controls .
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* create tree control
CREATE OBJECT go_tree
EXPORTING
parent = go_docking
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = 'X' " required for double-click event on item
no_html_header = ''
no_toolbar = ''
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
* create Hierarchy-header
DATA ls_hierarchy_header TYPE treev_hhdr.
PERFORM build_hierarchy_header CHANGING ls_hierarchy_header.
PERFORM build_fieldcatalog.
PERFORM set_layout_and_variant.
* create emty tree-control
CALL METHOD go_tree->set_table_for_first_display
EXPORTING
** i_structure_name = 'KNVV'
is_variant = gs_variant
i_save = 'A'
* i_default = 'X'
is_hierarchy_header = ls_hierarchy_header
* is_exception_field =
* it_special_groups =
* it_list_commentary =
* i_logo =
* i_background_id =
* it_toolbar_excluding =
* it_except_qinfo =
CHANGING
it_outtab = gt_outtab
* it_filter =
it_fieldcatalog = gt_fcat.
* create hierarchy
PERFORM create_hierarchy.
* register events
PERFORM register_events.
* adjust column_width
CALL METHOD go_tree->column_optimize.
ENDFORM. " init_controls
*& Form build_hierarchy_header
* build hierarchy-header-information
* -->P_L_HIERARCHY_HEADER strucxture for hierarchy-header
FORM build_hierarchy_header CHANGING
p_hierarchy_header TYPE treev_hhdr.
p_hierarchy_header-heading = 'Hierarchy Header'. "#EC NOTEXT
p_hierarchy_header-tooltip =
'This is the Hierarchy Header !'. "#EC NOTEXT
p_hierarchy_header-width = 30.
p_hierarchy_header-width_pix = ''.
ENDFORM. " build_hierarchy_header
*& Form BUILD_FIELDCATALOG
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog .
REFRESH: gt_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNVV'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
DELETE gt_fcat FROM 8.
ENDFORM. " BUILD_FIELDCATALOG
*& Form SET_LAYOUT_AND_VARIANT
* text
* --> p1 text
* <-- p2 text
FORM set_layout_and_variant .
CLEAR: gs_layout,
gs_variant.
gs_variant-report = syst-repid.
gs_variant-handle = 'TREE'.
ENDFORM. " SET_LAYOUT_AND_VARIANT
*& Form create_hierarchy
* text
* --> p1 text
* <-- p2 text
FORM create_hierarchy .
DATA: ls_knvv TYPE sflight,
ls_outtab TYPE ty_s_outtab,
lt_outtab TYPE ty_t_outtab.
* get data
SELECT * FROM knvv INTO CORRESPONDING FIELDS OF TABLE lt_outtab
UP TO 200 ROWS . "#EC CI_NOWHERE
SORT lt_outtab BY kunnr vkorg.
* add data to tree
DATA: ld_kunnr_key TYPE lvc_nkey,
ld_vkorg_key TYPE lvc_nkey,
ld_last_key TYPE lvc_nkey.
LOOP AT lt_outtab INTO ls_outtab.
ON CHANGE OF ls_outtab-kunnr.
PERFORM add_customer_line USING ls_outtab-data
CHANGING ld_kunnr_key.
ENDON.
ON CHANGE OF ls_outtab-vkorg.
PERFORM add_salesorg_line USING ls_outtab-data
ld_kunnr_key
CHANGING ld_vkorg_key.
ENDON.
PERFORM add_complete_line USING ls_outtab-data
ld_vkorg_key
CHANGING ld_last_key.
ENDLOOP.
* calculate totals
CALL METHOD go_tree->update_calculations.
* this method must be called to send the data to the frontend
CALL METHOD go_tree->frontend_update.
ENDFORM. " create_hierarchy
*& Form add_customer_line
* add hierarchy-level 1 to tree
* -->P_LS_SFLIGHT sflight
* -->P_RELEATKEY relatkey
* <-->p_node_key new node-key
FORM add_customer_line USING us_data TYPE ty_s_outtab-data
ud_relat_key TYPE lvc_nkey
CHANGING cd_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value,
ls_data TYPE ty_s_outtab-data.
* set item-layout
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
ls_item_layout-t_image = '@A0@'. " icon_customer.
ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
APPEND ls_item_layout TO lt_item_layout.
* add node
l_node_text = us_data-kunnr.
DATA: ls_node TYPE lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
CALL METHOD go_tree->add_node
EXPORTING
i_relat_node_key = ud_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_data
is_node_layout = ls_node
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = cd_node_key.
ENDFORM. " add_customer_line
*& Form add_salesorg_line
* add hierarchy-level 1 to tree
* -->P_LS_SFLIGHT sflight
* -->P_RELEATKEY relatkey
* <-->p_node_key new node-key
FORM add_salesorg_line USING us_data TYPE ty_s_outtab-data
ud_relat_key TYPE lvc_nkey
CHANGING cd_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value,
ls_data TYPE ty_s_outtab-data.
* set item-layout
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
ls_item_layout-t_image = '@DS@'. " ICON_PARTNER_SALES_ACTIVITY
ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
ls_item_layout-style =
cl_gui_column_tree=>style_intensifd_critical.
APPEND ls_item_layout TO lt_item_layout.
* add node
l_node_text = us_data-vkorg.
DATA: ls_node TYPE lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
CALL METHOD go_tree->add_node
EXPORTING
i_relat_node_key = ud_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
i_node_text = l_node_text
is_outtab_line = ls_data
is_node_layout = ls_node
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = cd_node_key.
ENDFORM. " add_salesorg_line
*& Form add_cmplete_line
* add hierarchy-level 3 to tree
* -->P_LS_SFLIGHT sflight
* -->P_RELEATKEY relatkey
* <-->p_node_key new node-key
FORM add_complete_line USING us_data TYPE ty_s_outtab-data
ud_relat_key TYPE lvc_nkey
CHANGING cd_node_key TYPE lvc_nkey.
DATA: l_node_text TYPE lvc_value.
* set item-layout
DATA: lt_item_layout TYPE lvc_t_layi,
ls_item_layout TYPE lvc_s_layi.
ls_item_layout-fieldname = go_tree->c_hierarchy_column_name.
ls_item_layout-class = cl_gui_column_tree=>item_class_checkbox.
** ls_item_layout-editable = 'X'.
APPEND ls_item_layout TO lt_item_layout.
** CLEAR ls_item_layout.
** ls_item_layout-fieldname = 'PLANETYPE'.
** ls_item_layout-alignment = cl_gui_column_tree=>align_right.
** APPEND ls_item_layout TO lt_item_layout.
l_node_text = us_data-vtweg.
DATA: ls_node TYPE lvc_s_layn.
ls_node-n_image = space.
ls_node-exp_image = space.
CALL METHOD go_tree->add_node
EXPORTING
i_relat_node_key = ud_relat_key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = us_data
i_node_text = l_node_text
is_node_layout = ls_node
it_item_layout = lt_item_layout
IMPORTING
e_new_node_key = cd_node_key.
ENDFORM. " add_complete_line
*& Form register_events
* text
* --> p1 text
* <-- p2 text
FORM register_events.
* define the events which will be passed to the backend
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event.
* define the events which will be passed to the backend
l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
APPEND l_event TO lt_events.
** l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.
** APPEND l_event TO lt_events.
** l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.
** APPEND l_event TO lt_events.
** l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.
** APPEND l_event TO lt_events.
** l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.
** APPEND l_event TO lt_events.
** l_event-eventid = cl_gui_column_tree=>eventid_header_click.
** APPEND l_event TO lt_events.
** l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.
** APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
APPEND l_event TO lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
APPEND l_event TO lt_events.
CALL METHOD go_tree->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
* set Handler
set handler:
lcl_eventhandler=>handle_node_double_click for go_tree,
lcl_eventhandler=>handle_item_double_click for go_tree.
** DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
** CREATE OBJECT l_event_receiver.
** SET HANDLER l_event_receiver->handle_node_ctmenu_request
** FOR tree1.
** SET HANDLER l_event_receiver->handle_node_ctmenu_selected
** FOR tree1.
** SET HANDLER l_event_receiver->handle_item_ctmenu_request
** FOR tree1.
** SET HANDLER l_event_receiver->handle_item_ctmenu_selected
** FOR tree1.
** SET HANDLER l_event_receiver->handle_checkbox_change FOR tree1.
ENDFORM. " register_events
Regards
Uwe -
Need explanation on output(Threads).
Hi,
I am new to Threads and need an explanation on the
Output got from the program below.
I executed this program below :
/*================================================
MultiThreadDemo.sqlj
===============================================*/
import java.sql.SQLException;
import java.util.Random;
import sqlj.runtime.ExecutionContext;
import oracle.sqlj.runtime.Oracle;
class MultiThreadDemo extends Thread
double raise;
static Random randomizer = new Random();
public static void main(String []args)
try
Oracle.connect(MultiThreadDemo.class,"connect.properties");
double avgStart = calcAvgSal();
MultiThreadDemo t1 = new MultiThreadDemo(250.50);
MultiThreadDemo t2 = new MultiThreadDemo(150.50);
t1.start();
t2.start();
t1.join();
if(t1.isAlive())
System.out.println(" Thread t1 is Still Alive");
t2.join();
if(t2.isAlive())
System.out.println(" Thread t2 is Still Alive");
double avgEnd = calcAvgSal();
System.out.println("Avg Sal Change : "+(avgEnd-avgStart));
catch(Exception e)
System.out.println("Error running the example : "+ e);
static double calcAvgSal() throws SQLException
double avg;
#sql { SELECT AVG(sal) into :avg from emp};
return avg;
MultiThreadDemo(double raise)
this.raise = raise;
public void run()
System.out.println(" Executing run() ");
try
System.out.println(" Executing try block in run() ");
//delay();
ExecutionContext execCtx = new ExecutionContext();
#sql [execCtx] { UPDATE emp set sal = sal + :raise };
int updateCount = execCtx.getUpdateCount();
System.out.println("Give raise of "+ raise+"to "+updateCount+" employees");
catch(SQLException e)
System.err.println("error updating employees : "+ e);
private void delay()
System.out.println(" Executing delay() ");
try
sleep((long)Math.abs(randomizer.nextInt()/10000000));
catch(InterruptedException e)
==========================================================
===========
Output
============
$ java MultiThreadDemo
Executing run()
Executing try block in run()
Executing run()
Executing try block in run()
Give raise of 250.5 to 7 employees
Give raise of 150.5 to 7 employees
Avg Sal Change : 402.0
=============================
Shouldn't the Output be ??:
=============================
executing run()
executing try block in run()
Give raise of 250.5 to 7 employees
executing run()
executing try block in run()
Give raise of 150.5 to 7 employees
Avg Sal Change : 402.0
================================================
Can anyone explain the Output clearly, as I am
new to Using Threads.
Thanks
SharathReply to my own post:
I think the solution lies in using the "synchronized" keyword for the run() method in order to make it a mutex
and get the o/p as desired. -
What is the problem in my Thread Dump's output?
Dear all,
Below is my Thread Dump output. I can not figure out what and where is the problem of this Thread Dump's output. Could some one please give me some hints?
Thanks alot
Tu
----------------Thread Dump's Output-----------------
Full thread dump Java HotSpot(TM) Client VM (1.5.0_07-b03 mixed mode, sharing):
"TP-Monitor" daemon prio=1 tid=0xb0b14490 nid=0xfaa in Object.wait()
[0xb08fe000..0xb08fee40]
at java.lang.Object.wait(Native Method)
- waiting on <0x89433f70> (a
org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable)
at org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable.run(ThreadPool.java:559)
- locked <0x89433f70> (a
org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable)
at java.lang.Thread.run(Thread.java:595)
"TP-Processor4" daemon prio=1 tid=0xb0b13730 nid=0xfa9 runnable
[0xb097e000..0xb097efc0]
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
- locked <0x89438110> (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at org.apache.jk.common.ChannelSocket.accept(ChannelSocket.java:293)
at org.apache.jk.common.ChannelSocket.acceptConnections(ChannelSocket.java:647)
at org.apache.jk.common.ChannelSocket$SocketAcceptor.runIt(ChannelSocket.java:857)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
"TP-Processor3" daemon prio=1 tid=0xb0b0f6b8 nid=0xfa8 in
Object.wait() [0xb09fe000..0xb09fef40]
at java.lang.Object.wait(Native Method)
- waiting on <0x89434250> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89434250> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"TP-Processor2" daemon prio=1 tid=0xb0b0fec8 nid=0xfa7 in
Object.wait() [0xb0a7e000..0xb0a7f0c0]
at java.lang.Object.wait(Native Method)
- waiting on <0x894342e8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x894342e8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"TP-Processor1" daemon prio=1 tid=0xb0b14978 nid=0xfa6 in
Object.wait() [0xb0afe000..0xb0aff040]
at java.lang.Object.wait(Native Method)
- waiting on <0x89434380> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89434380> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Monitor" prio=1 tid=0x08609b18 nid=0xfa5 in Object.wait()
[0xb0cc9000..0xb0cc91c0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378950> (a
org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable)
at org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable.run(ThreadPool.java:559)
- locked <0x89378950> (a
org.apache.tomcat.util.threads.ThreadPool$MonitorRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor25" daemon prio=1 tid=0x08608ce0 nid=0xfa4
runnable [0xb0d48000..0xb0d49140]
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
- locked <0x89010c58> (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:60)
at org.apache.tomcat.util.net.PoolTcpEndpoint.acceptSocket(PoolTcpEndpoint.java:407)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:70)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor24" daemon prio=1 tid=0x086085f8 nid=0xfa3 in
Object.wait() [0xb0dc8000..0xb0dc8ec0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378ab8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89378ab8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor23" daemon prio=1 tid=0x08606dd0 nid=0xfa2 in
Object.wait() [0xb0e48000..0xb0e48e40]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378b50> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89378b50> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor22" daemon prio=1 tid=0x08605ed0 nid=0xfa1 in
Object.wait() [0xb0ec8000..0xb0ec8fc0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378be8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89378be8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor21" daemon prio=1 tid=0x08604fd0 nid=0xfa0 in
Object.wait() [0xb0f48000..0xb0f48f40]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378c80> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89378c80> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor20" daemon prio=1 tid=0x086040f0 nid=0xf9f in
Object.wait() [0xb0fc8000..0xb0fc90c0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378d18> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89378d18> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor19" daemon prio=1 tid=0x08432538 nid=0xf9e in
Object.wait() [0xb1048000..0xb1049040]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378db0> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89378db0> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor18" daemon prio=1 tid=0x08431638 nid=0xf9d in
Object.wait() [0xb10c9000..0xb10c91c0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378e48> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89378e48> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor17" daemon prio=1 tid=0x08430738 nid=0xf9c in
Object.wait() [0xb1148000..0xb1149140]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378ee0> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89378ee0> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor16" daemon prio=1 tid=0x0842f838 nid=0xf9b in
Object.wait() [0xb11c8000..0xb11c8ec0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89378f78> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89378f78> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor15" daemon prio=1 tid=0x0842e938 nid=0xf9a in
Object.wait() [0xb1248000..0xb1248e40]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379010> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379010> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor14" daemon prio=1 tid=0x0842da38 nid=0xf99 in
Object.wait() [0xb12c8000..0xb12c8fc0]
at java.lang.Object.wait(Native Method)
- waiting on <0x893790a8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x893790a8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor13" daemon prio=1 tid=0x0842cb38 nid=0xf98 in
Object.wait() [0xb1348000..0xb1348f40]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379140> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379140> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor12" daemon prio=1 tid=0x0842bc50 nid=0xf97 in
Object.wait() [0xb13c8000..0xb13c90c0]
at java.lang.Object.wait(Native Method)
- waiting on <0x893791d8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x893791d8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor11" daemon prio=1 tid=0x084f75d0 nid=0xf96 in
Object.wait() [0xb1448000..0xb1449040]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379270> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379270> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor10" daemon prio=1 tid=0x084f66d0 nid=0xf95 in
Object.wait() [0xb14c9000..0xb14c91c0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379308> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379308> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor9" daemon prio=1 tid=0x084f57d0 nid=0xf94 in
Object.wait() [0xb1548000..0xb1549140]
at java.lang.Object.wait(Native Method)
- waiting on <0x893793a0> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x893793a0> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor8" daemon prio=1 tid=0x08488970 nid=0xf93 in
Object.wait() [0xb15c8000..0xb15c8ec0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379438> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379438> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor7" daemon prio=1 tid=0x08487a70 nid=0xf92 in
Object.wait() [0xb1648000..0xb1648e40]
at java.lang.Object.wait(Native Method)
- waiting on <0x893794d0> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x893794d0> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor6" daemon prio=1 tid=0x08486b90 nid=0xf91 in
Object.wait() [0xb16c8000..0xb16c8fc0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379568> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379568> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor5" daemon prio=1 tid=0x084e3e30 nid=0xf90 in
Object.wait() [0xb1748000..0xb1748f40]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379600> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379600> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor4" daemon prio=1 tid=0x084e2f90 nid=0xf8f in
Object.wait() [0xb17c8000..0xb17c90c0]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379698> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379698> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor3" daemon prio=1 tid=0x084e2158 nid=0xf8e in
Object.wait() [0xb1848000..0xb1849040]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379730> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379730> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor2" daemon prio=1 tid=0x085e74d0 nid=0xf8d in
Object.wait() [0xb18c9000..0xb18c91c0]
at java.lang.Object.wait(Native Method)
- waiting on <0x893797c8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x893797c8> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"http-8080-Processor1" daemon prio=1 tid=0x085e6638 nid=0xf8c in
Object.wait() [0xb1948000..0xb1949140]
at java.lang.Object.wait(Native Method)
- waiting on <0x89379860> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Object.wait(Object.java:474)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:656)
- locked <0x89379860> (a
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable)
at java.lang.Thread.run(Thread.java:595)
"ContainerBackgroundProcessor[StandardEngine[Catalina]]" daemon prio=1
tid=0x083719f8 nid=0xf8b waiting on condition [0xb1a85000..0xb1a85ec0]
at java.lang.Thread.sleep(Native Method)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1547)
at java.lang.Thread.run(Thread.java:595)
"Low Memory Detector" daemon prio=1 tid=0x080a44f8 nid=0xf7f runnable
[0x00000000..0x00000000]
"CompilerThread0" daemon prio=1 tid=0x080a2f98 nid=0xf7e waiting on
condition [0x00000000..0xb21b2928]
"Signal Dispatcher" daemon prio=1 tid=0x080a2068 nid=0xf7d waiting on
condition [0x00000000..0x00000000]
"Finalizer" daemon prio=1 tid=0x0809c540 nid=0xf7c in Object.wait()
[0xb24b2000..0xb24b3040]
at java.lang.Object.wait(Native Method)
- waiting on <0x88f01de0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
- locked <0x88f01de0> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
"Reference Handler" daemon prio=1 tid=0x0809a6b0 nid=0xf7b in
Object.wait() [0xb2533000..0xb25331c0]
at java.lang.Object.wait(Native Method)
- waiting on <0x88f01e60> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:474)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
- locked <0x88f01e60> (a java.lang.ref.Reference$Lock)
"main" prio=1 tid=0x0805d1c8 nid=0xf79 runnable [0xbfbd9000..0xbfbda4f8]
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:384)
- locked <0x8946f690> (a java.net.SocksSocketImpl)
at java.net.ServerSocket.implAccept(ServerSocket.java:450)
at java.net.ServerSocket.accept(ServerSocket.java:421)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:388)
at org.apache.catalina.startup.Catalina.await(Catalina.java:615)
at org.apache.catalina.startup.Catalina.start(Catalina.java:575)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
"VM Thread" prio=1 tid=0x08097b58 nid=0xf7a runnable
"VM Periodic Task Thread" prio=1 tid=0x080a5998 nid=0xf80 waiting on conditionThanks alot for your reply. It is a web application
using java and tomcat server. And the problem is that
sometime when I click on a button or a link than the
CPU goes to 100% and it hangs but normally it works
smoothly without any problem.This often indicates a busy retry loop somewhere. You need to acquire the thread dump when the problem occurs, but be warned that depending on the problem it may not be possible to obtain a Java-level thread dump. In that case you need to try and take an OS level thread dump - eg using pstack on solaris/linux (and there's some win32 tool as well if I recall correctly). -
How to get a thread dump, in case of an IDE freeze
When you're working with the IDE and if it either freezes or becomes sluggish for no apparent reason, it's recommended to generate a thread dump, and report it to Studio feedback alias ([email protected]) with a description of what happened and attach the dump to it.
A thread dump is an invaluable source of information to IDE developers when investigating deadlocks and some performance issues. It is a textual dump of all active threads and monitors of Java apps running in a Virtual Machine.
The ways to generate a thread dump differ depending on the platform:
* Windows systems
Press Ctrl-Break in the command console you used to start the IDE.
You won't be able to see the console in case you started the IDE using the default desktop icon created by the IDE installer. To be able to generate the thread dump, you must launch the IDE using a console window (invoke Command Prompt, go to {studio-install-dir}/bin and type runide.exe), or configure the desktop shortcut properties to launch the runide.exe program instead of the default runidew.exe.
Note: You should increase the screen buffer size of the command prompt, so that it could retian the entire thread dump output. To do that, on the command prompt where IDE is running, open the properties dialog box by right clicking on the titlebar and selecting 'properties'. Then select the 'layout tab' and increase the 'screen buffer size' parameters to - width - 200, Height - 4000.
* Unix systems
Press Ctrl-\ in the terminal console you used to start the JSE.
Alternatively, you can also generate a thread dump by sending the QUIT signal to the Java VM running the JSE
kill -QUIT process_id
where process_id is the process number of the respective java process.
-------Here is a sample thread dump -------
Full thread dump Java HotSpot(TM) Client VM (1.4.2_01-b06 mixed mode):
"Text-Layout" daemon prio=2 tid=0x0886ebd8 nid=0x4e4 in Object.wait() [9e8f000..9e8fd94]
at java.lang.Object.wait(Native Method)
- waiting on <0x11730910> (a org.netbeans.editor.view.spi.ViewLayoutQueue)
at java.lang.Object.wait(Object.java:429)
at org.netbeans.editor.view.spi.ViewLayoutQueue.waitForTask(ViewLayoutQueue.java:128)
- locked <0x11730910> (a org.netbeans.editor.view.spi.ViewLayoutQueue)
at org.netbeans.editor.view.spi.ViewLayoutQueue$LayoutThread.run(ViewLayoutQueue.java:182)
"Compilation" daemon prio=2 tid=0x0883d878 nid=0xb1c in Object.wait() [9c8f000..9c8fd94]
at java.lang.Object.wait(Native Method)
- waiting on <0x1143dde0> (a java.util.LinkedList)
at java.lang.Object.wait(Object.java:429)
at org.netbeans.core.compiler.CompilationEngineImpl$CompilerThread.nextJobAndTask(CompilationEngineImpl.java:162)
- locked <0x1143dde0> (a java.util.LinkedList)
at org.netbeans.core.compiler.CompilationEngineImpl$CompilerThread.run(CompilationEngineImpl.java:175)
"TimerQueue" daemon prio=5 tid=0x03575478 nid=0xb18 in Object.wait() [988f000..988fd94]
at java.lang.Object.wait(Native Method)
- waiting on <0x10d4af60> (a javax.swing.TimerQueue)
at javax.swing.TimerQueue.run(TimerQueue.java:231)
- locked <0x10d4af60> (a javax.swing.TimerQueue)
at java.lang.Thread.run(Thread.java:534)
"AWT-EventQueue-1" prio=7 tid=0x0344fae0 nid=0xb14 in Object.wait() [3caf000..3cafd94]
at java.lang.Object.wait(Native Method)
- waiting on <0x10d4afe8> (a java.awt.EventQueue)
at java.lang.Object.wait(Object.java:429)
at java.awt.EventQueue.getNextEvent(EventQueue.java:339)
- locked <0x10d4afe8> (a java.awt.EventQueue)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:162)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)You can get a thread dump (Windows only) whitout any preparation. Simply use the Stack Trace tool from this web site:
http://tmitevski.users.mcs2.netarray.com
It works on Windows services too. -
I am getting error exception in the thread, its compile correctly
import java.util.*;
import java.io.*;
import java.lang.*;
import java.util.*;
import java.io.*;
* Class implementing a basic neural network.
public class NeuralNetwork1
double[] hidden;
double[] nethidden;
double[][] weight_hidden_input;
double[][]weight_output_hidden;
double[] netoutput;
double[] output;
double[] training_targets;
double[][] training_inputs;
double[] test_targets;
double[][] test_inputs;
double[] training_error;
double[] test_error;
double[] Deltaweight_hidden_input;
double[] Deltaweight_output_hidden;
double bias = 1;
int learningrate = 1;
int number_of_training_sets;
int number_of_targets;
int number_hidden;
int number_output;
int dataToUseForTraining = 10;
int numberOfDataToUseForValidation = 3;
int dataWindowSize =4;
int number_of_epics = 10;
int counter = 0;
Vector t = new Vector();
public static void main(String[] args){
NeuralNetwork1 n = new NeuralNetwork1();
public NeuralNetwork1()
GetData1 gd = new GetData1(dataToUseForTraining, numberOfDataToUseForValidation, dataWindowSize);
// initialize variables for network
hidden = new double[number_hidden];
nethidden = new double[number_hidden];
Deltaweight_hidden_input=new double[hidden.length];
Deltaweight_output_hidden = new double[netoutput.length];
weight_output_hidden = new double[1][number_hidden];//due to bias
weight_hidden_input=new double[(number_output*number_hidden)+number_hidden][dataWindowSize+1];
netoutput = new double[number_output];
training_targets = gd.getTargetData();
training_inputs = gd.getTrainingData();
test_targets = gd.getTestTargetData();
test_inputs = gd.getTestData();
training_error = new double[training_targets.length];
output = new double[training_targets.length];
//train network
train();
//predict
predict();
public void train() {
for(int i=0; i<number_of_epics; i++) {
System.out.println("inside train");
forwardPass();
backProp();
public void forwardPass() {
double netIH = 0;
double netHO = 0;
do {
//forward pass
//input to hidden
for(int i=0; i<hidden.length; i++) {
for(int j=1; j<training_inputs.length; j++) {
netIH = netIH + (weight_hidden_input[1][j])*(training_inputs[counter][j-1]);
netIH = netIH + (bias*weight_hidden_input[1][0]);
nethidden[i] = netIH;
hidden[i] = sigmoid(netIH);
//hidden to output
for(int i=0; i<netoutput.length; i++) {
for(int j=1; j<hidden.length; j++) {
netHO = netHO + hidden[j]*weight_output_hidden[i][j];
netHO = netHO + (bias* weight_output_hidden[0][hidden.length]);
output[i] = netHO;
output[counter] = sigmoid(netHO);
training_error[counter] = training_targets[counter]-output[counter];
//backProp here
counter++;
}while(counter<number_of_training_sets);
// sigmoid function
public double sigmoid(double x) {
return 1/(1+Math.exp(x));
public void backProp() {
//calculate the training_error for the output layer
for(int i=0; i<netoutput.length; i++) {
Deltaweight_output_hidden[i] = training_error[counter]*output*(1-output[i]);
double tempweight_output_hidden[][] = new double[weight_output_hidden.length][weight_output_hidden.length];
//calculate output_hidden weights adjustment
for(int n=0; n<weight_output_hidden.length; n++) {
for(int m=0; m<hidden.length; m++) {
tempweight_output_hidden[n][m] = learningrate*Deltaweight_output_hidden[n]*hidden[m];
double Total_DeltaWeights[] = new double[hidden.length];
//calculate the training_error for the hidden layer
for(int r=0; r<hidden.length; r++) {
for(int t=0; t<dataWindowSize; t++) {
Total_DeltaWeights[r] = Total_DeltaWeights[r] + Deltaweight_hidden_input[t]*weight_hidden_input[t][r];
Deltaweight_hidden_input[r] =Total_DeltaWeights[r]*(1-Total_DeltaWeights[r]);
System.out.println("Deltaweight_hidden_input["+r+"] = " );
double tempweight_hidden_input[][] = new double[weight_hidden_input.length][weight_hidden_input[0].length];
//calculate input layer weight changes
for(int n=0; n<hidden.length; n++) {
for(int w=0; w<weight_hidden_input[n].length; w++) {
tempweight_hidden_input[n][w] = -(learningrate*Deltaweight_hidden_input[n]*training_inputs[n][w]);
//weightUpdate
for(int v=0; v<weight_hidden_input.length; v++) {
for(int w=0; w<weight_hidden_input.length; w++) {
weight_hidden_input[v][w] = weight_hidden_input[v][w] + tempweight_hidden_input[v][w];
for(int v=0; v<weight_output_hidden.length; v++) {
for(int w=0; w<weight_output_hidden.length; w++) {
weight_output_hidden[v][w] = weight_output_hidden[v][w] + tempweight_output_hidden[v][w];
public void predict() {
class GetData1 extends NeuralNetwork1{
double trainingSet[][];
double targetSet[];
double testSet[][];
double testTargetSet[];
double crossValidationSet[][];
double validationTargetSet[];
Vector vData = new Vector();
double data[];
double td[];
double ts[];
double max;
double min;
int numberOfDataToUseForTraining;
int sizeOfDataWindow;
int numberOfDataToUseForValidation;
public static void main(String args[]) {
GetData1 g = new GetData1(10,5,2);
GetData1(int dataToUseForTraining, int numberOfDataToUseForValidation, int dataWindowSize) {
numberOfDataToUseForTraining = dataToUseForTraining;
sizeOfDataWindow = dataWindowSize;
this.numberOfDataToUseForValidation = numberOfDataToUseForValidation;
readDataFromFile();
normalizeData();
makeTrainingSet(0);
makeTestingSet();
makeCrossValidationSet(0);
public double[][] getTrainingData() {
makeTrainingSet(0);
return trainingSet;
public double[] getTargetData() {
makeTrainingSet(0);
return targetSet;
public double[][] getTestData() {
return testSet;
public double[] getTestTargetData() {
return testTargetSet;
public double[] getValidationTargetData() {
makeCrossValidationSet(0);
return validationTargetSet;
public double[][] getCrossValidationTargetSet() {
makeCrossValidationSet(0);
return crossValidationSet;
public double xmax() {
return max;
public double xmin() {
return min;
public void readDataFromFile() {
BufferedReader rawData = null;
try {
FileReader file = new FileReader("data.txt");
rawData = new BufferedReader(file);
} catch(FileNotFoundException x) {;}
try {
String line;
while( (line = rawData.readLine()) != null ) {
vData.add(line);
} catch(IOException x) {
x.printStackTrace();
public void normalizeData() {
int j=0;
data = new double[vData.size()];
for(int i=0; i<vData.size(); i++) {
data[i] = (double)Double.parseDouble(vData.get(i).toString());
double getTheMaxAndMin[] = new double[data.length];
for(int i=0; i<data.length; i++) {
getTheMaxAndMin[i] = data[i];
Arrays.sort(getTheMaxAndMin);
max = getTheMaxAndMin[getTheMaxAndMin.length-1];
min = getTheMaxAndMin[0];
for(int i=0; i<data.length; i++) {
data[i] = (data[i]-min)/(max-min);
public void makeTrainingSet(int whereToStart) {
//how much data to use for traiing - sizeo of data window + 1
int numberOfSteps = (numberOfDataToUseForTraining-sizeOfDataWindow+1)-whereToStart;
trainingSet = new double[numberOfSteps-1][sizeOfDataWindow];
targetSet = new double[numberOfSteps-1];
int j=0;
for(int i=0; i<numberOfSteps-1; i++) {
int k = 0;
int count = 0;
do {
trainingSet[i][k] = data[j+whereToStart];
k++;
j++;
count++;
} while(count < sizeOfDataWindow);
j = j - (sizeOfDataWindow - 1);
for(int i=sizeOfDataWindow; i<numberOfSteps+sizeOfDataWindow-1; i++) {
targetSet[i-sizeOfDataWindow] = data[i];
for(int i=0; i<trainingSet.length; i++) {
// trainingSet[i][trainingSet[i].length-1] = 1;
public void makeCrossValidationSet(int whereToStart) {
//how much data to use for traiing - sizeo of data window + 1
int numberOfSteps = (numberOfDataToUseForValidation-sizeOfDataWindow+1)-whereToStart;
crossValidationSet = new double[numberOfDataToUseForValidation+numberOfDataToUseForTraining][sizeOfDataWindow];
validationTargetSet = new double[numberOfDataToUseForValidation+numberOfDataToUseForTraining];
int j=0;
for(int i=0; i<crossValidationSet.length; i++) {
int k = 0;
int count = 0;
do {
crossValidationSet[i][k] = data[j+whereToStart];
k++;
j++;
count++;
} while(count < sizeOfDataWindow);
j = j - (sizeOfDataWindow - 1);
for(int i=0; i<validationTargetSet.length; i++) {
validationTargetSet[i] = data[i];
for(int i=0; i<crossValidationSet.length; i++) {
// crossValidationSet[i][crossValidationSet[i].length-1] = 1;
public void makeTestingSet() {
//how much data to use for traiing - sizeo of data window + 1
int numberOfSteps = data.length-sizeOfDataWindow+1;
testSet = new double[numberOfSteps-1][sizeOfDataWindow];
testTargetSet = new double[numberOfSteps-1];
int j=0;
for(int i=0; i<numberOfSteps-1; i++) {
int k = 0;
int count = 0;
do {
testSet[i][k] = data[j];
k++;
j++;
count++;
} while(count < sizeOfDataWindow);
j = j - (sizeOfDataWindow - 1);
for(int i=sizeOfDataWindow; i<numberOfSteps+sizeOfDataWindow-1; i++) {
testTargetSet[i-sizeOfDataWindow] = data[i];
for(int i=0; i<numberOfSteps-1; i++) {
// testSet[i][testSet[i].length-1] = 1;
public void makeTestingSet1() {
int numberOfSteps = data.length - sizeOfDataWindow;
testSet = new double[numberOfSteps][trainingSet[0].length];
for(int i=0; i<trainingSet.length; i++) {
for(int j=0; j<trainingSet[i].length; j++) {
testSet[i][j] = trainingSet[i][j];
testTargetSet = new double[data.length-sizeOfDataWindow];
for(int i=sizeOfDataWindow; i<numberOfSteps+sizeOfDataWindow-1; i++) {
testTargetSet[i-sizeOfDataWindow] = data[i];wanjeri wrote:
sorry but what do u mean by code tagCode tag: Place one at the beginning and one at the end of your code and repost it. (It will make the code easier to read.)
As for the error you're getting, please post more information, ie, the stack trace. -
Urgent :- Sending output to SAP User's inbox as Excel Attachment.
Hi,
This is urgent requirement
Requirement Description in breif :-
1.I have a report and but when run in background, it should create an excel file and should be sent as attachment to sap inbox of the same user who is executing the report.
2.I have tried all most all function modules. the limitations were some of the F.M are not supported in background mode (which the sap it self uses) And I could able to send data to excel excel file only upto 255 chars per record. i.e these F.M's are allowing me to send a internal table but every record of 255 chars only.
3.Which is not sufficient to send my ITAB contents. and contents after 255 are truncating.
Sending output of report in Excel Format ,in BackgroundHi srinivas,
check this thread
Convert output display to Excel file and Email to a set of users
Regards,
Raj -
Thread Dump issue with LD_ASSUME_KERNEL=2.4.1
Hi ,
When I take Thread Dump using 'jstack <PID>' in JDK 1.5 it givss me "sun.jvm.hotspot.debugger.DebuggerException" in the dump nothing more
I set LD_ASSUME_KERNEL=2.4.1 in my server to avaoid some other issue ( JVM crash some times)
Surprisingly, I can not stop my server ( my java process ) after that using our Shutdow scripts , Ctrl C or even "kill -9 <PID>",
I have to restart the machine or manually release uncleaned resources that my server occupied and restart the server
This happens Redhar 9 as well as in Linux ES.
Anybody faced similar problem?
Any help or information regarding this is highly apprecialted
Vasu
Thread Dump Output:
Caused by: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet0(Native Meth
od)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$800(LinuxDebuggerLocal.java:34)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(Li
nuxDebuggerLocal.java:431)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(Linux
DebuggerLocal.java:109)
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_re
gs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(L
inuxDebuggerLocal.java:134)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebugge
rLocal.java:437)
at sun.jvm.hotspot.debugger.linux.LinuxThread.getContext(LinuxThread.java:48)
at sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess.getCurrentFrameGuess(LinuxX86
JavaThreadPDAccess.java:75)
at sun.jvm.hotspot.runtime.JavaThread.getCurrentFrameGuess(JavaThread.java:252)
at sun.jvm.hotspot.runtime.JavaThread.getLastJavaVFrameDbg(JavaThread.java:211)
at sun.jvm.hotspot.tools.StackTrace.run(StackTrace.java:42)
at sun.jvm.hotspot.tools.JStack.run(JStack.java:41)
at sun.jvm.hotspot.tools.Tool.start(Tool.java:204)
at sun.jvm.hotspot.tools.JStack.main(JStack.java:58)
Caused by: sun.jvm.hotspot.debugger.DebuggerException: get_thread_regs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet0(Native Meth
od)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.access$800(LinuxDebuggerLocal.java:34)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$1GetThreadIntegerRegisterSetTask.doit(Li
nuxDebuggerLocal.java:431)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.run(Linux
DebuggerLocal.java:109)
sun.jvm.hotspot.debugger.DebuggerException: sun.jvm.hotspot.debugger.DebuggerException: get_thread_re
gs failed for a lwp
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal$LinuxDebuggerLocalWorkerThread.execute(L
inuxDebuggerLocal.java:134)
at sun.jvm.hotspot.debugger.linux.LinuxDebuggerLocal.getThreadIntegerRegisterSet(LinuxDebugge
rLocal.java:437)@brain0
I've downloaded the glic-2.3.6 sources from gnu, so I could build it from those. I'm however reluctant to do this because I really don't want to break my install.
I do agree with you on the NPTL statement, but pvs relies on allegro, which relies on LinuxThreads. Allegro is not being ported to new versions of glibc, so that approach is unfortunately not viable.
@iphitus
I wasn't very specific - it's allegro as in a lisp environment.
I think I'll try and install an old version of arch on wmware instead. Is there anywhere you can check out glibc version numbering on old arch install isos (ie. do I need arch-0.[1-9].iso)? And anywhere you can download the old isos (tried filewatcher, but a lot of the older sites seem broken)?
Thanks for the replies,
Mads
PS. I noticed that you recommended slackware for old kernels in another thread. I'm however in a bit different situation as I need old versions of glibc. Furthermore I would prefer sticking to arch, but was wondering whether there were any specific reasons for not doing that. -
How to Generate XML Output file
Hi,
I want to print sample output XML file.
I got this link 362496.1
An output file can be generated via the Preview functionality available under the XML Publisher Administrator responsibility. Navigation path :
1. Login to the application as SYSADMIN
2. Responsibility: XML Publisher Administrator
3. Function: Templates
4. Select a Template for which a Preview Data file has been uploaded in the past.
5. Click on the Preview icon
6. Save the PDF to the client PC
7. Determine the version either by the above instructions OR by provide the PDF file to Global Customer Support.But in #4 I can not populate any values to search, even if I put all %.
How can I get a valid search?
Thanks a lot,
Ms KHi;
AFAIK if you prepare template in XML publisher than you can take output as pdf, by the way you can take xml output too
Please check user guide:
http://www.oracle.com/technology/products/xml-publisher/docs/XMLP5.6.1UserGuide.pdf
Oracle XML Publisher and Oracle Reports
Oracle XML Publisher and Oracle Reports
Also Please check below thread:
XML output for pdf concurrent program
http://www.quovera.com/whitepapers/downloads/xml_oracle.pdf
Generate XML output using DBMS_XMLGEN.getxmltype and not from rdf
http://www.orafaq.com/forum/t/35204/2/
Hope it helps
Regard
Helios -
Enter Output Type Each Type while Printing Invoice
Dear All,
Have searched in the forum already for a proper answer but could not find one.
The issue is, while printing the invoice, the system is not automatically determining the output type even though all the output determination configurations have been made.
I have to manually enter the output type by entering into the billing document header data.
Kindly let me know if I have missed on any configuration during output determination.
Thanks and Regards
AdithyaI hope you did what mentioned you.
If you have doubt, whether the output type is getting determined properly or not.
Use Tcode VF02.
If Header Output Type -
select Goto option from Menubar - Then Header - Choose Output.
Accordingly, If the output type is Item related then
select Goto option from Menubar - Then Item - Choose Output.
Then Change: Output screen in your billing doc(VF02), in menubar select Goto - then choose Determin. Analysis.
In output determination procedure in Analysis Output screen, track your desire output type and its determination status.
Check routine for requirement against output type in:
1. Output determination procedure
2. In access sequence for the output type, check routine against access/condition table.
Finally, accordinly determine output condition record by using TCode VV31 for the desired output type.
Further, check routine for requirement like 62 is assigned against output type in:
1. Output determination procedure
2. In access sequence for the output type, check routine against access/condition table.
Also, have look on one my recently discussed SD thread:
- Re: Output to be blocked for Billing documents, if not released to Accounting
Regards
JP -
Hi guys,
I'm trying to learn more about threads......i've written a small program for a better understand, but i don't understand the order of the output i'm getting:
public class testme {
public static void main(String[] args) {
Theshape mover = new Theshape("go");
mover.start();
System.out.println ("checkpoint 1");
System.out.println ("checkpoint 2");
}//main
}//class testme
class Theshape extends Thread {
public int count;
public String thego;
Theshape (String gg){
thego= gg;
count=0;
}//constructor
public void run(){
try {
do{
System.out.println (thego);
sleep(1000);
System.out.println ("johnny");
count=count+1;
}while(count<8);
} catch (InterruptedException e) {}
}//run
}//class theshape
........the output i get is:
checkpoint 1
checkpoint 2
go
johnny
go
johnny
go
johnny
go
johnny
go
johnny
go
johnny
go
johnny
go
johnny
I would like to know why "checkpoint 1" and "checkpoint 2" is printed first, even though the call to the run method is made before the two statements. i would have thought that the two checkpoint statements would be printed last.
Can anyone help?
Thanks,
ZafAfter you've issued the 'mover.start()' call, a new thread pops into existence. The first thread (your main thread) continues to run while the second thread prepares itself to start up. On your machine, this startup takes a (little) while, so your main thread is able to print those two line just before the other thread is able to print something. That's all there is to it. If you put a 'Thread.sleep(1234)' between those two println statements in your main thread, the output would probably be a bit different. Give it a try.
kind regards,
Jos -
Can't get Thread IDs to display in server.log or syslog
I'm trying to capture the Java thread IDs for a custom application. According to the SunOne documentation, the thread IDs are only available if you configure the app to use the syslog for logging... even then, the thread IDs are optional.
I've configured the app server to log through the syslogd and turned up the logging to finest. Still no thread IDs output to the log. Any suggestions?I've read that page - several times. I still can't it to work. Part of the problem that page is that it's talking about adding an existing WIT to the backlog, instead of a custom WIT.
I inherited a customized template and I'm trying to further customize it, which is probably adding to my struggle. Can you spot anything wrong or missing here?
From categories.xml:
<CATEGORY name="Team Backlog Item Category" refname="MyCompany.TeamBacklogItemCategory">
<DEFAULTWORKITEMTYPE name="User Story" />
<WORKITEMTYPE name="Spike" />
<WORKITEMTYPE name="Bug" />
<WORKITEMTYPE name="Technical Story" />
<WORKITEMTYPE name="Report" />
</CATEGORY>
From process Settings:
<RequirementBacklog category="MyCompany.TeamBacklogItemCategory" pluralName="Team Backlog Items" singularName="Team Backlog Item">
<States>
<State value="New" type="Proposed" />
<State value="Approved" type="Proposed" />
<State value="Committed" type="InProgress" />
<State value="Done" type="Complete" />
</States>
<Columns>
<Column refname="System.WorkItemType" width="100" />
<Column refname="System.Title" width="300" />
<Column refname="System.State" width="100" />
<Column refname="Microsoft.VSTS.Common.Priority" width="50" />
<Column refname="Microsoft.VSTS.Scheduling.Effort" width="50" />
<Column refname="System.IterationPath" width="200" />
<Column refname="System.Tags" width="200" />
</Columns>
<AddPanel>
<Fields>
<Field refname="System.Title" />
</Fields>
</AddPanel>
</RequirementBacklog>
Also, do I have to do anything special to get the web portal to "refresh" after making changes like this?
Thank you.
Maybe you are looking for
-
Hi, My screen on my ipod mini is black with small dots. It looks like space. Does anyone have any suggestions, please? Thank you. Cindy
-
hi thisis the script i am using to allocate gross invoice percentage for month and total them to show in another row *SELECT (%ENTITY%, "[ID]", "ENTITY", "[ID]='%ENTITY_SET%'") *XDIM_MEMBERSET CATEGORY=ACT *XDIM_MEMBERSET RPTCURRENCY1=LC *XDIM_MEMBER
-
Logic's Biggest Bug - Anyone got a workaround?
The problem is importing WAV's with Long Filenames into the Audio Window, & then EXS sampler keys. In one of my previous posts I explained that I lost all my work since purchasing Logic Pro last year (100+ logic songs), after I formatted OSX and then
-
Batch management AR-Invoices.
Hi everybody, How can I do, when I create an AR-Invoice, to select the material batches, with an specific criteria? Because the system only permits me take batches in secuencial order
-
Best practice to upgrade NAC Failover deployment
Hi, I have a NAC Failover deployment with 5 pairs of CAS and 1 pair of CAM running version 4.1.3 and i want to upgrate to 4.7.2 My deployment is Inband Virtual Gateway. I have 5 floors and one pair of CAS in each one, so, my question is: I'm reading