[gatein-commits] gatein SVN: r5161 - components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Nov 18 09:45:08 EST 2010
Author: chris.laprun at jboss.com
Date: 2010-11-18 09:45:07 -0500 (Thu, 18 Nov 2010)
New Revision: 5161
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
Log:
- GTNWSRP-164: Reworked how and when the ProducerInfo is persisted to reduce the number of calls to the persistence layer.
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-11-18 14:43:00 UTC (rev 5160)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/ProducerInfo.java 2010-11-18 14:45:07 UTC (rev 5161)
@@ -396,10 +396,9 @@
RefreshResult result = new RefreshResult(); // success by default!
- boolean didJustRefresh = false;
try
{
- didJustRefresh = persistentEndpointInfo.refresh();
+ persistentEndpointInfo.refresh();
}
catch (InvokerUnavailableException e)
{
@@ -408,25 +407,14 @@
// try again as refresh on a failed service factory will fail without attempting the refresh
try
{
- didJustRefresh = persistentEndpointInfo.forceRefresh();
+ persistentEndpointInfo.forceRefresh();
}
catch (InvokerUnavailableException e1)
{
result.setStatus(RefreshResult.Status.FAILURE);
return result;
}
-
- // todo: should we fail fast here?
- // throw new PortletInvokerException("Couldn't refresh endpoint information: " + e.getLocalizedMessage());
}
- finally
- {
- // save changes to endpoint only if we just refreshed, otherwise unneeded
- if (didJustRefresh)
- {
- registry.updateProducerInfo(this);
- }
- }
// get the service description from the producer
try
@@ -490,7 +478,7 @@
{
// if the registration validation has issues, we need to modify our local information
setModifyRegistrationRequired(true);
- setActiveAndSave(false);
+ setActive(false);
}
else
{
@@ -553,7 +541,6 @@
// refresh and force check for extra props if the registered SD failed
// todo: deal with forcing check of extra registration properties properly (if needed)
RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, true, forceRefresh, false);
- registry.updateProducerInfo(this);
// attempt to register and determine if the current service description can be used to extract POPs
if (!registrationResult.hasIssues())
@@ -1031,7 +1018,15 @@
public void register() throws PortletInvokerException
{
- register(null, false);
+ try
+ {
+ register(null, false);
+ }
+ catch (PortletInvokerException e)
+ {
+ registry.updateProducerInfo(this);
+ throw e;
+ }
}
/**
@@ -1102,15 +1097,11 @@
setActive(false);
throw new PortletInvokerException("Couldn't register with producer '" + persistentId + "'", e);
}
- finally
- {
- registry.updateProducerInfo(this);
- }
}
else
{
log.debug(result.getStatus().toString());
- setActiveAndSave(false);
+ setActive(false);
throw new PortletInvokerException("Consumer is not ready to be registered with producer because of missing or invalid registration information.");
}
}
@@ -1149,7 +1140,14 @@
public void modifyRegistration() throws PortletInvokerException
{
- modifyRegistration(false);
+ try
+ {
+ modifyRegistration(false);
+ }
+ finally
+ {
+ registry.updateProducerInfo(this);
+ }
}
private void modifyRegistration(boolean force) throws PortletInvokerException
@@ -1192,10 +1190,6 @@
{
throw new PortletInvokerException("Couldn't modify registration with producer '" + persistentId + "'", e);
}
- finally
- {
- registry.updateProducerInfo(this);
- }
}
}
else
More information about the gatein-commits
mailing list