Skip to content

Commit 561338e

Browse files
committed
Clear cached job information when loadInformation() is called, so the next time an attribute is refreshed, it will throw an exception if the job has gone away.
1 parent 938e18e commit 561338e

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

src/com/ibm/as400/access/Job.java

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// The source code contained herein is licensed under the IBM Public License
88
// Version 1.0, which has been approved by the Open Source Initiative.
9-
// Copyright (C) 1997-2001 International Business Machines Corporation and
9+
// Copyright (C) 1997-2002 International Business Machines Corporation and
1010
// others. All rights reserved.
1111
//
1212
///////////////////////////////////////////////////////////////////////////////
@@ -54,7 +54,7 @@
5454
public class Job
5555
implements Serializable
5656
{
57-
private static final String copyright = "Copyright (C) 1997-2001 International Business Machines Corporation and others.";
57+
private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others.";
5858

5959

6060

@@ -6372,6 +6372,31 @@ public void loadInformation()
63726372
// Need to load an attribute from each format.
63736373
try
63746374
{
6375+
// @F0A - begin
6376+
// Clear all values.
6377+
values_.clear();
6378+
6379+
// Reset all of the important information
6380+
if (internalJobID_.equals(""))
6381+
{
6382+
setValueInternal(INTERNAL_JOB_ID, null);
6383+
setValueInternal(JOB_NAME, name_);
6384+
setValueInternal(USER_NAME, user_);
6385+
setValueInternal(JOB_NUMBER, number_);
6386+
}
6387+
else
6388+
{
6389+
setValueInternal(INTERNAL_JOB_ID, internalJobID_);
6390+
setValueInternal(JOB_NAME, null);
6391+
setValueInternal(USER_NAME, null);
6392+
setValueInternal(JOB_NUMBER, null);
6393+
}
6394+
setValueInternal(JOB_STATUS, status_);
6395+
setValueInternal(JOB_TYPE, type_);
6396+
setValueInternal(JOB_SUBTYPE, subtype_);
6397+
// @F0A - end
6398+
6399+
// Retrieve all values.
63756400
retrieve(THREAD_COUNT); // 150
63766401
retrieve(CURRENT_SYSTEM_POOL_ID); // 200
63776402
retrieve(JOB_DATE); // 300

src/com/ibm/as400/access/JobHashtable.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// The source code contained herein is licensed under the IBM Public License
88
// Version 1.0, which has been approved by the Open Source Initiative.
9-
// Copyright (C) 1997-2001 International Business Machines Corporation and
9+
// Copyright (C) 1997-2002 International Business Machines Corporation and
1010
// others. All rights reserved.
1111
//
1212
///////////////////////////////////////////////////////////////////////////////
@@ -26,12 +26,25 @@
2626
**/
2727
final class JobHashtable implements java.io.Serializable
2828
{
29+
private static final String copyright = "Copyright (C) 1997-2002 International Business Machines Corporation and others.";
30+
2931
static final long serialVersionUID = 5L;
3032
private static final int HASH = 4;
3133
final Object[][] values_ = new Object[HASH][];
3234
final int[][] keys_ = new int[HASH][];
3335
int size_ = 0;
3436

37+
//@F0A
38+
final void clear()
39+
{
40+
for (int i=0; i<HASH; ++i)
41+
{
42+
values_[i] = null;
43+
keys_[i] = null;
44+
}
45+
size_ = 0;
46+
}
47+
3548
final boolean contains(int key)
3649
{
3750
if (key == 0) return false;

0 commit comments

Comments
 (0)