policyContainer.setAdjunct(this, rval);
}
- return ((ContainerAdjunct) rval);
+ return (ContainerAdjunct) rval;
}
/**
*/
@Override
public int getSequenceNumber() {
- return (1);
+ return 1;
}
/**
public PolicySession.ThreadModel selectThreadModel(PolicySession session) {
PolicyContainer policyContainer = session.getPolicyContainer();
if (isPersistenceEnabled(policyContainer, session.getName())) {
- return (new PersistentThreadModel(session, getProperties(policyContainer)));
+ return new PersistentThreadModel(session, getProperties(policyContainer));
}
- return (null);
+ return null;
}
/**
KieSessionConfiguration kConf = kieSvcFact.newKieSessionConfiguration();
- KieSession kieSession = (desiredSessionId >= 0 ? loadKieSession(kieBaseName, desiredSessionId, env, kConf)
- : null);
+ KieSession kieSession = desiredSessionId >= 0 ? loadKieSession(kieBaseName, desiredSessionId, env, kConf)
+ : null;
if (kieSession == null) {
// loadKieSession() returned null or desiredSessionId < 0
*/
private long getSessionId(DroolsSessionConnector conn, String sessnm) {
DroolsSession sess = conn.get(sessnm);
- return (sess != null ? sess.getSessionId() : -1);
+ return sess != null ? sess.getSessionId() : -1;
}
/**
if (properties != null) {
// fetch the 'type' property
String type = getProperty(properties, sessionName, "type");
- rval = ("auto".equals(type) || "native".equals(type));
+ rval = "auto".equals(type) || "native".equals(type);
}
- return (rval);
+ return rval;
}
/**
*/
private Properties getProperties(PolicyContainer container) {
try {
- return (fact.getPolicyContainer(container).getProperties());
+ return fact.getPolicyContainer(container).getProperties();
} catch (IllegalArgumentException e) {
logger.error("getProperties exception: ", e);
- return (null);
+ return null;
}
}
value = properties.getProperty("persistence." + property);
}
- return (value);
+ return value;
}
/* ============================================================ */
* @return the String to use as the thread name
*/
private String getThreadName() {
- return ("Session " + session.getFullName() + " (persistent)");
+ return "Session " + session.getFullName() + " (persistent)";
}
/***************************/
* and consequently the second value will be the less likely.
*/
protected final HashMap<String, Pair<ProtocolCoderToolset,ProtocolCoderToolset>> coders =
- new HashMap<String, Pair<ProtocolCoderToolset,ProtocolCoderToolset>>();
+ new HashMap<>();
/**
* Mapping topic + classname -> Protocol Set
*/
protected final HashMap<String, List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>> reverseCoders =
- new HashMap<String, List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>>();
+ new HashMap<>();
protected boolean multipleToolsetRetries = false;
this, reverseKey, key, toolsets.first());
List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>> reverseMappings =
- new ArrayList<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>();
+ new ArrayList<>();
reverseMappings.add(toolsets);
reverseCoders.put(reverseKey, reverseMappings);
}
// are detected in the gson encoding
Pair<ProtocolCoderToolset,ProtocolCoderToolset> coderTools =
- new Pair<ProtocolCoderToolset,ProtocolCoderToolset>(gsonCoderTools,
+ new Pair<>(gsonCoderTools,
jacksonCoderTools);
logger.info("{}: adding coders for new {}: {}", this, key, coderTools.first());
}
} else {
List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>> toolsets =
- new ArrayList<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>();
+ new ArrayList<>();
toolsets.add(coderTools);
logger.info("{}: adding toolset for reverse key {}: {}", this, reverseKey, toolsets);
String key = this.codersKey(groupId, artifactId, topic);
synchronized(this) {
- return (coders.containsKey(key));
+ return coders.containsKey(key);
}
}
protected List<DroolsController> droolsCreators(String topic, Object encodedClass)
throws IllegalStateException, IllegalArgumentException {
- List<DroolsController> droolsControllers = new ArrayList<DroolsController>();
+ List<DroolsController> droolsControllers = new ArrayList<>();
String reverseKey = this.reverseCodersKey(topic, encodedClass.getClass().getCanonicalName());
if (!this.reverseCoders.containsKey(reverseKey)) {
// figure out the right toolset
String groupId = encoderSet.first().getGroupId();
String artifactId = encoderSet.first().getArtifactId();
- List<CoderFilters> coders = encoderSet.first().getCoders();
- for (CoderFilters coder : coders) {
+ List<CoderFilters> coderFilters = encoderSet.first().getCoders();
+ for (CoderFilters coder : coderFilters) {
if (coder.getCodedClass().equals(encodedClass.getClass().getCanonicalName())) {
DroolsController droolsController =
DroolsController.factory.get(groupId, artifactId, "");
String key = this.codersKey(groupId, artifactId, "");
- List<CoderFilters> codersFilters = new ArrayList<CoderFilters>();
+ List<CoderFilters> codersFilters = new ArrayList<>();
for (Map.Entry<String, Pair<ProtocolCoderToolset,ProtocolCoderToolset>> entry : coders.entrySet()) {
if (entry.getKey().startsWith(key)) {
codersFilters.addAll(entry.getValue().first().getCoders());
String key = this.codersKey(groupId, artifactId, "");
- List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>> coderToolset = new ArrayList<Pair<ProtocolCoderToolset,ProtocolCoderToolset>>();
+ List<Pair<ProtocolCoderToolset,ProtocolCoderToolset>> coderToolset = new ArrayList<>();
for (Map.Entry<String, Pair<ProtocolCoderToolset,ProtocolCoderToolset>> entry : coders.entrySet()) {
if (entry.getKey().startsWith(key)) {
coderToolset.add(entry.getValue());
throw new IllegalArgumentException("No Coder found for " + key);
- List<CoderFilters> coders = new ArrayList<CoderFilters>();
+ List<CoderFilters> coderFilters = new ArrayList<>();
for (Pair<ProtocolCoderToolset,ProtocolCoderToolset> toolset: toolsets) {
- coders.addAll(toolset.first().getCoders());
+ coderFilters.addAll(toolset.first().getCoders());
}
- return coders;
+ return coderFilters;
}
/**
builder.append("EventProtocolEncoder [toString()=").append(super.toString()).append("]");
return builder.toString();
}
-}
\ No newline at end of file
+}