Skip to content

Commit

Permalink
IGNITE-14308 Convert exception to warning in case of local deployment…
Browse files Browse the repository at this point in the history
… with unexpected node id.
  • Loading branch information
alamar committed Mar 17, 2021
1 parent a5a5063 commit c510805
Showing 1 changed file with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -603,14 +603,15 @@ public void prepare(GridCacheDeployable deployable) throws IgnitePeerToPeerClass
if (locDep0 != null) {
// Will copy sequence number to bean.
dep = new GridDeploymentInfoBean(locDep0);

checkDeploymentIsCorrect(dep, deployable, false);
}
}
else
checkDeploymentIsCorrect(dep, deployable, true);

if (dep != null) {
checkDeploymentIsCorrect(dep, deployable);

if (dep != null)
deployable.prepare(dep);
}

if (log.isDebugEnabled())
log.debug("Prepared grid cache deployable [dep=" + dep + ", deployable=" + deployable + ']');
Expand All @@ -622,16 +623,22 @@ public void prepare(GridCacheDeployable deployable) throws IgnitePeerToPeerClass
*
* @param deployment Deployment.
* @param deployable Deployable message.
* @param failIfNotCorrect Flag determining whether to throw exception or just warn.
* @throws IgnitePeerToPeerClassLoadingException If deployment is incorrect.
*/
private void checkDeploymentIsCorrect(GridDeploymentInfoBean deployment, GridCacheDeployable deployable)
private void checkDeploymentIsCorrect(GridDeploymentInfoBean deployment, GridCacheDeployable deployable,
boolean failIfNotCorrect)
throws IgnitePeerToPeerClassLoadingException {
if (deployment.participants() == null
&& !cctx.localNode().id().equals(deployment.classLoaderId().globalId())) {
throw new IgnitePeerToPeerClassLoadingException("Failed to use deployment to prepare deployable, " +
"because local node id does not correspond with class loader id, and there are no more participants " +
"[localNodeId=" + cctx.localNode().id() + ", deployment=" + deployment + ", deployable=" + deployable +
", locDep=" + locDep.get() + "]");
String msg = "Should not use deployment to prepare deployable, because local node id does not correspond " +
"with class loader id, and there are no more participants [locNodeId=" + cctx.localNode().id() +
", deployment=" + deployment + ", deployable=" + deployable + ", locDep=" + locDep.get() + "]";

if (failIfNotCorrect)
throw new IgnitePeerToPeerClassLoadingException(msg);

log.warning(msg);
}
}

Expand Down

0 comments on commit c510805

Please sign in to comment.