Skip to content

Commit

Permalink
PAYARA-1079 Add DataGrid Timer Store (#2394)
Browse files Browse the repository at this point in the history
* PAYARA-1079 add HZ EJB Timer store to Payara 5

* PAYARA-1070 Renamed persistence services to DataGrid and Database.
Persistence Service is selectable in the administration console

* PAYARA-1079 Admin console buttons for Deployment Groups sort of working

* PAYARA-1079 Initial clustering and timer migration works across the data grid for all deployed applications

* PAYARA-1079 fix timer buttons

* PAYARA-1079 List Timers, Migrate Timers now works in both database and datagrid persistence mode. Clustered failover works in Datagrid

* PAYARA-1079 Fix issue whereby after whole cluster restart timers are not reactivated

* PAYARA-1070 minor white space changes
  • Loading branch information
smillidge authored and arjantijms committed Feb 18, 2018
1 parent 49a2835 commit 3cf4f61
Show file tree
Hide file tree
Showing 23 changed files with 627 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<event>
<!afterCreate
getUIComponent(clientId="#{sheetId}" component=>$attribute{component})
includeIntegrations(type="org.glassfish.admingui:ejbTimerButtons" root="#{component}");
includeIntegrations(type="org.glassfish.admingui:ejbTimerButtonsDG" root="#{component}");
/>
</event>

Expand Down
106 changes: 106 additions & 0 deletions appserver/admingui/cluster/src/main/resources/dg/listEjbTimersDG.jsf
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<!--

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.

The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.

When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.

GPL Classpath Exception:
Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the GPL Version 2 section of the License
file that accompanied this code.

Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"

Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.

Portions Copyright [2018] [Payara Foundation and/or its affiliates]
-->



<!initPage
setResourceBundle(key="i18ncs" bundle="org.glassfish.cluster.admingui.Strings")
setResourceBundle(key="i18nc" bundle="org.glassfish.common.admingui.Strings")
setResourceBundle(key="help_common" bundle="org.glassfish.common.admingui.Helplinks");
/>
<!composition template="/templates/default.layout"
guiTitle="$resource{i18ncs.clusters.ejbTimers.PageTitle}"
>
<!define name="content">
<event>
<!beforeCreate
setPageSessionAttribute(key="tableTitle" value="$resource{i18ncs.clusters.ejbTimers.TableTitle}");
getRequestValue(key="dgName" value="#{pageSession.dgName}");
urlencode(value="#{pageSession.dgName}" encoding="UTF-8" result="#{pageSession.encodedDGName}");

gf.restRequest(endpoint="#{sessionScope.REST_URL}/list-timers?target=#{pageSession.encodedDGName}"
attrs="#{requestScope.attrsMap}" method="get" result="#{requestScope.resp}");
setAttribute(key="listOfRows" value="#{requestScope.resp.data.extraProperties.ejbTimers}");
setPageSessionAttribute(key="parentPage" value="#{request.contextPath}/cluster/dg/dgGeneral.jsf?dgName=#{pageSession.encodedDGName}");
gf.isDGName(dgName="#{pageSession.dgName}" );
/>
</event>
<sun:form id="propertyForm">
#include "/cluster/dg/dgTabs.inc"
#include "/common/shared/alertMsg_1.inc"

<sun:title id="propertyContentPage" title="$resource{i18ncs.clusters.ejbTimers.PageTitle}" >
<!facet pageButtonsTop>
<sun:panelGroup id="topButtons">
<sun:button id="cancelButton" immediate="#{true}" primary="#{false}" rendered="#{pageSession.showCancelButton}" text="$resource{i18n.button.Back}" >
<!command
gf.redirect(page="#{parentPage}");
/>
</sun:button>
</sun:panelGroup>
</facet>
</sun:title>
<sun:table id="configs" title="#{tableTitle}" >
<!afterCreate
getClientId(component="$this{component}" clientId=>$page{tableId});
/>
"<br/ > <br />
<sun:tableRowGroup id="rowGroup1" data={"$attribute{listOfRows}"} sourceVar="td">
<!afterCreate
getClientId(component="$this{component}" clientId=>$page{tableRowGroupId});
/>

<sun:tableColumn headerText="$resource{i18ncs.general.serverNameCol}" rowHeader="$boolean{true}" id="col1">
<sun:staticText id="serverNameCol" value="#{td.value.server}" />
</sun:tableColumn>

<sun:tableColumn headerText="$resource{i18ncs.clusters.ejbTimers.TimerCountCol}" rowHeader="$boolean{true}" id="col6">
<sun:staticText id="timerCountCol" value="#{td.value.timerCount}" />
</sun:tableColumn>
</sun:tableRowGroup>
</sun:table>

</sun:form>

</define>
</composition>
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<!--

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright (c) 2010-2013 Oracle and/or its affiliates. All rights reserved.

The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.

When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.

GPL Classpath Exception:
Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the GPL Version 2 section of the License
file that accompanied this code.

Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"

Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.

Portions Copyright [2018] [Payara Foundation and/or its affiliates]

-->

<!initPage
setResourceBundle(key="i18ncs" bundle="org.glassfish.cluster.admingui.Strings")
setResourceBundle(key="i18nc" bundle="org.glassfish.common.admingui.Strings")
setResourceBundle(key="help_cluster" bundle="org.glassfish.cluster.admingui.Helplinks");
/>
<!composition template="/templates/default.layout" guiTitle="$resource{i18ncs.cluster.migrateEjbTimers}" >
<!define name="content">
<event>
<!beforeCreate
setSessionAttribute(key="dgTabs" value="general");
getRequestValue(key="dgName" value="#{pageSession.dgName}");
urlencode(value="#{pageSession.dgName}" encoding="UTF-8" result="#{pageSession.encodedDGName}");
setPageSessionAttribute(key="selfPage" value="#{request.contextPath}/dg/migrateEjbTimersDG.jsf?dgName=#{pageSession.encodedDGName}");
setPageSessionAttribute(key="parentPage" value="#{request.contextPath}/cluster/dg/dgGeneral.jsf?dgName=#{pageSession.encodedDGName}");

setPageSessionAttribute(key="resourceUrl", value="#{sessionScope.REST_URL}/deployment-groups/deployment-group/#{pageSession.encodedDGName}");
setPageSessionAttribute(key="rest-api" value="true");

//set the following for including buttons.inc
setPageSessionAttribute(key="edit" value="#{true}" );
setPageSessionAttribute(key="showDefaultButton" value="#{false}" );
setPageSessionAttribute(key="showCancelButton" value="#{true}" );

gf.restRequest(endpoint="#{pageSession.resourceUrl}/list-instances", method="get", result="#{requestScope.results}");
setPageSessionAttribute(key="dgInstances", value="#{requestScope.results.data.extraProperties.instanceList}");
createList(result="#{pageSession.runningInstances}", size="0");
createList(result="#{pageSession.notRunningInstances}", size="0");
foreach (var="instance", list="#{pageSession.dgInstances}") {
if ('#{instance.status} = NOT_RUNNING') {
listAdd(list="#{pageSession.notRunningInstances}", value="#{instance.name}");
}
if ('!(#{instance.status} = NOT_RUNNING)') {
listAdd(list="#{pageSession.runningInstances}", value="#{instance.name}");
}
}
gf.isDGName(dgName="#{pageSession.dgName}" );
/>
</event>
<sun:form id="propertyForm">
#include "/cluster/dg/dgTabs.inc"
#include "/common/shared/alertMsg_1.inc"
<!-- Page Title -->
<sun:title id="propertyContentPage" title="$resource{i18ncs.cluster.migrateEjbTimers}" helpText="$resource{i18ncs.cluster.migrateEjbTimersHelp}">
<!facet pageButtonsTop>
<sun:panelGroup id="topButtons">
<sun:button id="saveButton" text="$resource{i18n.button.OK}" disabled="#{empty runningInstances}">
<!command
createMap(result="#{requestScope.attrs}");
mapPut(map="#{requestScope.attrs}", key="target", value="#{pageSession.destInstance}");
mapPut(map="#{requestScope.attrs}", key="id", value="#{pageSession.sourceInstance}");
gf.restRequest(endpoint="#{pageSession.resourceUrl}/migrate-timers.json", attrs="#{requestScope.attrs}", method="post", result="#{requestScope.results}");
prepareAlertMsg(type="success", summary="#{requestScope.results.data.subReports[0].message}");
gf.redirect(page="#{selfPage}&alertType=${alertType}&alertSummary=${alertSummary}&alertDetail=${alertDetail}");
/>
</sun:button>
<sun:button id="cancelButton" immediate="#{true}" primary="#{false}" rendered="#{pageSession.showCancelButton}" text="$resource{i18n.button.Cancel}" >
<!command
gf.redirect(page="#{parentPage}");
/>
</sun:button>
</sun:panelGroup>
</facet>
</sun:title>

<h:panelGroup rendered="#{!empty runningInstances}">
<sun:propertySheet id="propertySheet">
<!-- Text Field section -->
<sun:propertySheetSection id="propertSectionTextField">
<sun:property id="clusterSourceProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18ncs.cluster.sourceCluster}" >
<sun:dropDown id="source" selected="#{pageSession.sourceInstance}"labels="#{pageSession.notRunningInstances}"/>
</sun:property>
<sun:property id="clusterDestProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18ncs.cluster.destCluster}" >
<sun:dropDown id="dest" selected="#{pageSession.destInstance}" labels="#{pageSession.runningInstances}"/>
</sun:property>
</sun:propertySheetSection>
</sun:propertySheet>
</h:panelGroup>
<h:panelGroup rendered="#{empty runningInstances}">
"<br /> <br />
"<em>$resource{i18ncs.cluster.migrateEjbTimersNoRunningInstance}</em>
</h:panelGroup>

<sun:hidden id="helpKey" value="$resource{help_cluster.clusterMigrateEjbTimers}" />
</sun:form>
</define>
</composition>
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,12 @@
parentId=""
content="ejbTimerButtons.jsf"
/>

<!-- add the DG timer links -->
<integration-point
id="ejbTimersDG"
type="org.glassfish.admingui:ejbTimerButtonsDG"
priority="200"
parentId=""
content="ejbTimerButtonsDG.jsf"
/>
</console-config>
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@
<sun:textField id="RedeliveryIntr" styleClass="integer" columns="$int{20}" maxLength="#{sessionScope.fieldLengths['maxLength.ejbTimerSettings.redeliveryIntr']}" text="#{pageSession.valueMap['redeliveryIntervalInternalInMillis']}" />
<sun:staticText id="msecs" style="padding: 8pt" text="$resource{i18n.common.Milliseconds}"/>
</sun:property>
<sun:property id="persistenceServiceProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n_ejb.ejbTimerSettings.persistenceServiceLabel}" helpText="$resource{i18n_ejb.ejbTimerSettings.persistenceServiceHelp}" visible="#{true}" >
<sun:dropDown id="EjbTimerService" selected="#{pageSession.valueMap['ejbTimerService']}" required="#{false}" value="#{pageSession.valueMap['ejbTimerService']}" labels={"Database","DataGrid"} values={"Database","DataGrid"} >
</sun:dropDown>
</sun:property>
<sun:property id="clusterFiringModeProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n_ejb.ejbTimerSettings.clusterFiringModeLabel}" helpText="$resource{i18n_ejb.ejbTimerSettings.clusterFiringModeHelp}" visible="#{true}" >
<sun:dropDown id="ClusterFiringMode" selected="#{pageSession.valueMap['clusterFiringMode']}" required="#{false}" value="#{pageSession.valueMap['clusterFiringMode']}" labels={"One Per Data Grid","One Per Deployment Group","All Instances"} values={"OnePerCluster","OnePerDeploymentGroup","AllInstances"} >
</sun:dropDown>
</sun:property>
<sun:property id="TimerDatasourceProp" labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n_ejb.ejbTimerSettings.timerDatasourceLabel}" helpText="$resource{i18n_ejb.ejbTimerSettings.timerDatasourceLabelHelp}">
<sun:textField id="TimerDatasource" columns="$int{50}" maxLength="#{sessionScope.fieldLengths['maxLength.ejbTimerSettings.timerDatasource']}" text="#{pageSession.valueMap['timerDatasource']}" />
</sun:property>
Expand Down
53 changes: 53 additions & 0 deletions appserver/admingui/ejb/src/main/resources/ejbTimerButtonsDG.jsf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<!--

DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.

Copyright (c) 2012 Oracle and/or its affiliates. All rights reserved.

The contents of this file are subject to the terms of either the GNU
General Public License Version 2 only ("GPL") or the Common Development
and Distribution License("CDDL") (collectively, the "License"). You
may not use this file except in compliance with the License. You can
obtain a copy of the License at
https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
or packager/legal/LICENSE.txt. See the License for the specific
language governing permissions and limitations under the License.

When distributing the software, include this License Header Notice in each
file and include the License file at packager/legal/LICENSE.txt.

GPL Classpath Exception:
Oracle designates this particular file as subject to the "Classpath"
exception as provided by Oracle in the GPL Version 2 section of the License
file that accompanied this code.

Modifications:
If applicable, add the following below the License Header, with the fields
enclosed by brackets [] replaced by your own identifying information:
"Portions Copyright [year] [name of copyright owner]"

Contributor(s):
If you wish your version of this file to be governed by only the CDDL or
only the GPL Version 2, indicate your decision by adding "[Contributor]
elects to include this software in this distribution under the [CDDL or GPL
Version 2] license." If you don't indicate a single choice of license, a
recipient has the option to distribute your version of this file under
either the CDDL, the GPL Version 2 or to extend the choice of license to
its licensees as provided above. However, if you add GPL Version 2 code
and therefore, elected the GPL Version 2 license, then the option applies
only if the new code is made subject to such option by the copyright
holder.

-->

<sun:button id="migrateTimesButton" text="$resource{i18ncs.button.migrateEjbTimer}" primary="false">
<!command
gf.redirect(page="#{request.contextPath}/dg/migrateEjbTimersDG.jsf?dgName=#{pageSession.encodedDGName}");
/>
</sun:button>

<sun:button id="listTimersButton" text="$resource{i18ncs.button.listEjbTimers}" primary="false">
<!command
gf.redirect(page="#{request.contextPath}/dg/listEjbTimersDG.jsf?dgName=#{pageSession.encodedDGName}");
/>
</sun:button>
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ ejbTimerSettings.maxRedeliveryHelp=Number of attempts to redeliver failed notifi
ejbTimerSettings.redeliveryIntrLabel=Redelivery Interval:
ejbTimerSettings.redeliveryIntrHelp=Time between redelivery attempts
ejbTimerSettings.timerDatasourceLabel=Timer Datasource:
ejbTimerSettings.timerDatasourceLabelHelp=JNDI name of the JDBC resource that will be used as the timer datasource
ejbTimerSettings.timerDatasourceLabelHelp=JNDI name of the JDBC resource that will be used as the timer datasource when Database is selected as the Persistence Service
ejbTimerSettings.persistenceServiceLabel=Persistence Service
ejbTimerSettings.persistenceServiceHelp=Persistence Service for storing Persistent EJB Timers. Database stores in the specified datasource, DataGrid stores timers in-memory in the Data Grid. In Data Grid mode if all Data Grid instances are shutdown persistent timers will be lost
ejbTimerSettings.clusterFiringModeLabel=Clustered Timer Firing Mode
ejbTimerSettings.clusterFiringModeHelp=Determines how clustered timers fire. One Per Data Grid - only one timer will be active in the data grid. One Per Deployment Group - only one timer will be active within the targeted deployment group. All Instances - Timer will be active on all instances where the application is deployed.

# EJB Container Availability Service
availability.ejbContainerAvailability=EJB Container Availability
Expand Down
Loading

0 comments on commit 3cf4f61

Please sign in to comment.