BrightSide Workbench Full Report + Source Code
org.turro.push.sender.PushPoolSender Class Reference
Inheritance diagram for org.turro.push.sender.PushPoolSender:
Collaboration diagram for org.turro.push.sender.PushPoolSender:

Public Member Functions

 PushPoolSender (AssistantSet assistants, String payload)
 
void send (Consumer onFinish)
 
void run ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 33 of file PushPoolSender.java.

Constructor & Destructor Documentation

◆ PushPoolSender()

org.turro.push.sender.PushPoolSender.PushPoolSender ( AssistantSet  assistants,
String  payload 
)

Definition at line 39 of file PushPoolSender.java.

39  {
40  this.assistants = assistants;
41  this.payload = payload;
42  }

Member Function Documentation

◆ run()

void org.turro.push.sender.PushPoolSender.run ( )

Definition at line 54 of file PushPoolSender.java.

54  {
55  //int i = 1, count = assistants.size();
56  for (Assistant assistant : assistants) {
57  if(assistant.hasContact()) UserPushSubscription.pushMessage(assistant.contact.getId(), payload);
58  Logger.getLogger(PushPoolSender.class.getName()).log(Level.INFO, "Pushed message to {0}. Payload: {1}",
59  new Object[]{assistant.name, payload});
60  //if(count > 20 && ++i < count) Thread.sleep(100); // sleep only when using thread
61  }
62  if(onFinish != null) {
63  try {
64  onFinish.accept(null);
65  } catch (Exception ex) {
66  Logger.getLogger(PushPoolSender.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
67  }
68  }
69  }
PushPoolSender(AssistantSet assistants, String payload)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ send()

void org.turro.push.sender.PushPoolSender.send ( Consumer  onFinish)

Definition at line 44 of file PushPoolSender.java.

44  {
45  this.onFinish = onFinish;
46  if(assistants.size() > 20) {
47  new Thread(this).start();
48  } else {
49  run();
50  }
51  }
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: