Revision 483
Added by berkley about 24 years ago
src/edu/ucsb/nceas/metacat/DBSAXHandler.java | ||
---|---|---|
175 | 175 |
|
176 | 176 |
// The run method of xmlIndex thread. It writes XML Index for the document. |
177 | 177 |
public void run () { |
178 |
System.out.println("Jivka's thread is starting"); |
|
178 | 179 |
DBSAXNode currNode = null; |
179 | 180 |
DBSAXNode prevNode = null; |
180 | 181 |
int step = 0; |
... | ... | |
194 | 195 |
} |
195 | 196 |
|
196 | 197 |
conn.commit(); |
198 |
|
|
199 |
System.out.println("Jivka's thread is done executing"); |
|
200 |
//if this is a package file then write the package info to |
|
201 |
//the xml_relation table. relationHandler checks to see |
|
202 |
//if it is a package file so you don't have to do it here. |
|
203 |
DocumentImpl xmldoc = new DocumentImpl(conn, docid); |
|
204 |
System.out.println("starting chad's thread"); |
|
205 |
relationHandler rth = new relationHandler(xmldoc, conn); |
|
206 |
|
|
207 |
util.returnConnection(conn); |
|
197 | 208 |
conn.close(); |
198 |
|
|
209 |
//util.closeConnections(); |
|
210 |
|
|
199 | 211 |
} catch (Exception e) { |
200 | 212 |
try { |
201 | 213 |
conn.rollback(); |
... | ... | |
239 | 251 |
currentDocument.setTitle(new String(cbuf, start, MAXTITLELEN)); |
240 | 252 |
else |
241 | 253 |
currentDocument.setTitle(new String(cbuf, start, leftover)); |
242 |
} |
|
243 |
|
|
254 |
} |
|
244 | 255 |
} |
245 | 256 |
|
246 | 257 |
/** |
src/edu/ucsb/nceas/metacat/relationHandler.java | ||
---|---|---|
31 | 31 |
* relations. |
32 | 32 |
* @param xmldoc the xml document to index. |
33 | 33 |
*/ |
34 |
public relationHandler(DocumentImpl xmldoc) |
|
34 |
public relationHandler(DocumentImpl xmldoc, Connection con)
|
|
35 | 35 |
{ |
36 | 36 |
try |
37 | 37 |
{ |
38 |
conn = util.getConnection(); |
|
38 |
//conn = util.getConnection(); |
|
39 |
if(conn == null) |
|
40 |
{ |
|
41 |
conn = util.getConnection(); |
|
42 |
} |
|
43 |
else |
|
44 |
{ |
|
45 |
this.conn = con; |
|
46 |
} |
|
39 | 47 |
} |
40 | 48 |
catch(Exception e) |
41 | 49 |
{ |
42 |
System.out.println("error getting db connection in relationhandler"); |
|
50 |
System.out.println("error getting db connection in relationhandler:"); |
|
51 |
System.out.println(e.getMessage()); |
|
43 | 52 |
} |
44 | 53 |
|
45 | 54 |
this.xmldoc = xmldoc; |
... | ... | |
163 | 172 |
hasmorerows = rs.next(); |
164 | 173 |
} |
165 | 174 |
|
175 |
conn.commit(); |
|
166 | 176 |
util.returnConnection(conn); |
167 | 177 |
btThread = null; |
168 | 178 |
} |
... | ... | |
170 | 180 |
{ |
171 | 181 |
System.out.println("Error in relationHandler: " + e.getMessage()); |
172 | 182 |
util.debugMessage("Error in relationHandler: " + e.getMessage()); |
183 |
e.printStackTrace(System.out); |
|
173 | 184 |
btThread = null; |
174 | 185 |
} |
175 | 186 |
} |
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
824 | 824 |
} |
825 | 825 |
newdocid = DocumentImpl.write(conn, xml, doAction, accNumber, |
826 | 826 |
user, group); |
827 |
DocumentImpl xmldoc = new DocumentImpl(conn, newdocid); |
|
828 |
|
|
827 |
|
|
829 | 828 |
//if this is a package file then write the package info to |
830 | 829 |
//the xml_relation table. relationHandler checks to see |
831 | 830 |
//if it is a package file so you don't have to do it here. |
832 |
relationHandler rth = new relationHandler(xmldoc); |
|
831 |
//DocumentImpl xmldoc = new DocumentImpl(conn, newdocid); |
|
832 |
//relationHandler rth = new relationHandler(xmldoc, conn); |
|
833 | 833 |
|
834 | 834 |
} catch (NullPointerException npe) { |
835 | 835 |
newdocid = DocumentImpl.write(conn,xml,doAction,null,user,group); |
Also available in: Unified diff
allowed both indexing threads to run without interfering with each other.