@@ -4311,6 +4311,51 @@ public void opensearchDocumentSerializer(JsonGenerator jgen, Shepherd myShepherd
4311
4311
}
4312
4312
}
4313
4313
4314
+ public void opensearchIndexDeep ()
4315
+ throws IOException {
4316
+ this .opensearchIndex ();
4317
+
4318
+ final String encId = this .getId ();
4319
+ ExecutorService executor = Executors .newFixedThreadPool (4 );
4320
+ Runnable rn = new Runnable () {
4321
+ public void run () {
4322
+ Shepherd bgShepherd = new Shepherd ("context0" );
4323
+ bgShepherd .setAction ("Encounter.opensearchIndexDeep_" + encId );
4324
+ bgShepherd .beginDBTransaction ();
4325
+ try {
4326
+ Encounter enc = bgShepherd .getEncounter (encId );
4327
+ if ((enc == null ) || !enc .hasMarkedIndividual ()) {
4328
+ // bgShepherd.rollbackAndClose();
4329
+ executor .shutdown ();
4330
+ return ;
4331
+ }
4332
+ MarkedIndividual indiv = enc .getIndividual ();
4333
+ System .out .println ("opensearchIndexDeep() background indexing indiv " +
4334
+ indiv .getId () + " via enc " + encId );
4335
+ try {
4336
+ indiv .opensearchIndex ();
4337
+ } catch (Exception ex ) {
4338
+ System .out .println ("opensearchIndexDeep() background indexing " +
4339
+ indiv .getId () + " FAILED: " + ex .toString ());
4340
+ ex .printStackTrace ();
4341
+ }
4342
+ } catch (Exception e ) {
4343
+ System .out .println ("opensearchIndexDeep() backgrounding Encounter " + encId +
4344
+ " hit an exception." );
4345
+ e .printStackTrace ();
4346
+ } finally {
4347
+ bgShepherd .rollbackAndClose ();
4348
+ }
4349
+ System .out .println ("opensearchIndexDeep() backgrounding Encounter " + encId +
4350
+ " finished." );
4351
+ executor .shutdown ();
4352
+ }
4353
+ };
4354
+ System .out .println ("opensearchIndexDeep() begin backgrounding indiv for " + this );
4355
+ executor .execute (rn );
4356
+ System .out .println ("opensearchIndexDeep() [foreground] finished for Encounter " + encId );
4357
+ }
4358
+
4314
4359
// given a doc from opensearch, can user access it?
4315
4360
public static boolean opensearchAccess (org .json .JSONObject doc , User user ,
4316
4361
Shepherd myShepherd ) {
0 commit comments