diff options
author | Kajur, Harish (vk250x) <vk250x@att.com> | 2019-01-14 11:47:40 -0500 |
---|---|---|
committer | Kajur, Harish (vk250x) <vk250x@att.com> | 2019-01-14 11:48:05 -0500 |
commit | 1201f66412ab1585ec19e8630cb8b38e431dab8e (patch) | |
tree | 271c2e57b8662ef29c4c73ba331b5eeffca31af7 | |
parent | 5a4ff0ea07e8f5b5dde84c9ef171f188dd8a134c (diff) |
Remove the classes that were originally singleton
GremlinGroovy shell singleton and groovy builder singleton
were changed from being singleton because we found
that the classes that were dynamically loaded
were never cleaned up by the garbage collector
which caused a huge increase in the memory consumption
for the traversal microservice which uses this
The conversions from singleton was already committed
but the singleton was not cleaned up earlier
Issue-ID: AAI-1811
Change-Id: Ib74d85be4c1053e7b482fa5b89b562b2352ff803
Signed-off-by: Kajur, Harish (vk250x) <vk250x@att.com>
3 files changed, 0 insertions, 336 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/restcore/search/GremlinGroovyShellSingleton.java b/aai-core/src/main/java/org/onap/aai/restcore/search/GremlinGroovyShellSingleton.java deleted file mode 100644 index 328429b1..00000000 --- a/aai-core/src/main/java/org/onap/aai/restcore/search/GremlinGroovyShellSingleton.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.aai.restcore.search; - -import groovy.lang.Binding; -import groovy.lang.Script; -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; -import org.onap.aai.serialization.engines.TransactionalGraphEngine; - -import java.util.Map; - -/** - * Creates and returns a groovy shell with the - * configuration to statically import graph classes - * - */ -public class GremlinGroovyShellSingleton extends AAIAbstractGroovyShell { - - private GremlinGroovyShellSingleton() { - super(); - } - - private static class Helper { - private static final GremlinGroovyShellSingleton INSTANCE = new GremlinGroovyShellSingleton(); - } - - public static GremlinGroovyShellSingleton getInstance() { - - return Helper.INSTANCE; - } - - /** - * {@inheritDoc} - */ - @Override - public GraphTraversal<?, ?> executeTraversal (String traversal, Map<String, Object> params) { - Binding binding = new Binding(params); - Script script = shell.parse(traversal); - script.setBinding(binding); - return (GraphTraversal<?, ?>) script.run(); - } - - /** - * @throws UnsupportedOperationException - */ - @Override - public String executeTraversal(TransactionalGraphEngine engine, String traversal, Map<String, Object> params) { - throw new UnsupportedOperationException(); - } -} diff --git a/aai-core/src/main/java/org/onap/aai/restcore/search/GroovyQueryBuilderSingleton.java b/aai-core/src/main/java/org/onap/aai/restcore/search/GroovyQueryBuilderSingleton.java deleted file mode 100644 index 03a8bfc3..00000000 --- a/aai-core/src/main/java/org/onap/aai/restcore/search/GroovyQueryBuilderSingleton.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -package org.onap.aai.restcore.search; - -import groovy.lang.Binding; -import groovy.lang.Script; -import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.onap.aai.config.SpringContextAware; -import org.onap.aai.introspection.Loader; -import org.onap.aai.introspection.LoaderFactory; -import org.onap.aai.introspection.ModelType; -import org.onap.aai.query.builder.QueryBuilder; -import org.onap.aai.serialization.engines.QueryStyle; -import org.onap.aai.serialization.engines.TransactionalGraphEngine; -import org.onap.aai.setup.SchemaVersion; -import org.onap.aai.setup.SchemaVersions; - -import java.util.Map; - -/** - * Creates and returns a groovy shell with the - * configuration to statically import graph classes - * - */ -public class GroovyQueryBuilderSingleton extends AAIAbstractGroovyShell { - - private GroovyQueryBuilderSingleton() { - super(); - } - - private static class Helper { - private static final GroovyQueryBuilderSingleton INSTANCE = new GroovyQueryBuilderSingleton(); - } - - public static GroovyQueryBuilderSingleton getInstance() { - - return Helper.INSTANCE; - } - - /** - * {@inheritDoc} - */ - @Override - public String executeTraversal (TransactionalGraphEngine engine, String traversal, Map<String, Object> params) { - QueryBuilder<Vertex> builder = engine.getQueryBuilder(QueryStyle.GREMLIN_TRAVERSAL); - SchemaVersions schemaVersions = SpringContextAware.getBean(SchemaVersions.class); - Loader loader = SpringContextAware.getBean(LoaderFactory.class).createLoaderForVersion(ModelType.MOXY, schemaVersions.getDefaultVersion()); - - builder.changeLoader(loader); - Binding binding = new Binding(params); - binding.setVariable("builder", builder); - Script script = shell.parse(traversal); - script.setBinding(binding); - script.run(); - - return builder.getQuery(); - } - - /** - * @throws UnsupportedOperationException - */ - @Override - public GraphTraversal<?, ?> executeTraversal(String traversal, Map<String, Object> params) { - throw new UnsupportedOperationException(); - } -} diff --git a/aai-core/src/test/resources/test_aaiconfig.properties b/aai-core/src/test/resources/test_aaiconfig.properties deleted file mode 100644 index 3da70592..00000000 --- a/aai-core/src/test/resources/test_aaiconfig.properties +++ /dev/null @@ -1,185 +0,0 @@ -### -# ============LICENSE_START======================================================= -# org.openecomp.aai -# ================================================================================ -# Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. -# ================================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END========================================================= -### - -#################################################################### -# REMEMBER TO THINK ABOUT ENVIRONMENTAL DIFFERENCES AND CHANGE THE -# TEMPLATE AND *ALL* DATAFILES -#################################################################### - -aai.config.checktime=1000 - -# this could come from siteconfig.pl? -aai.config.nodename=AutomaticallyOverwritten - -aai.logging.hbase.interceptor=true -aai.logging.hbase.enabled=true -aai.logging.hbase.logrequest=true -aai.logging.hbase.logresponse=true - -aai.logging.trace.enabled=true -aai.logging.trace.logrequest=false -aai.logging.trace.logresponse=false - -ecm.openstack.tenantid=b0a529aba48440a39e0caf1aea9b27e3 -ecm.serviceid.trinity=UNUSED -ecm.serviceid.vusp=UNUSED -ecm.serviceid.ucpe=d7bb0a21-66f2-4e6d-87d9-9ef3ced63ae4 - -odl.host=https://odl.node01.it.app.sdn.labs.att.com:8443/ -odl.resourcepath=restconf/config/L3SDN-API:services/layer3-service-list -odl.ucpe.resourcepath=restconf/config/L3UCPE-API:services/ -odl.datachange.url=restconf/operations/DataChange:data-change-notification -odl.auth.type=BASIC -odl.auth.username=admin -odl.auth.password.x=f1e2c25183ef4b4ff655e7cd94d0c472 -odl.connection.timeout=15000 -odl.use.self.link.url=n -odl.instar.pickup.schdtask.enabled=y - -instar.pickup.cronRunOnThisHost=y -instar.pickup.dir=/opt/aaihome/m39384/pickup/ -instar.pickup.renameToDelete=y -instar.pickup.deleteStartsWithDelete=y -#every (12-1) * 5 minutes = 60 minutes to read ODL and generate INSTAR output files -instar.pickup.readcount.max=11 -instar.pickup.createheader=CustName|UBSubAccountID|EvcName|EvcCircuitId|InternetSpeed|RouterName|InterfaceName|VplsPeName|VplsPeInterface|CvlanTag|SvlanTag|IpVersion|RoutingProtocol|V6WanLinkIp|V4LanIPInfo|V6LanIPInfo|V4UnNumberedRefIp|V4VceLanIPs|V6VceLanIPs|ServiceOption|SubInterfaceID -instar.pickup.deleteheader=VceToVplsPeEvcCircuitId -instar.ts.file.pattern=V2(\\d{17})$ -instar.ts.entity.format=MMddyyyyHHmmss - -instarams.pickup.createheader.-vnf.txt=vnf_name|fqdn|maintenance_status|vnf_type|platform|network_type|service_type|application_vendor|application_type|application_name|application_version|mate_virtual_node|regional_resource_zone -instarams.pickup.createheader.-vm.txt=uuid|vm_name|fqdn|tenant_id|vm_host_name|uuid_mate|vm_name_mate|vnf_name|image_name|flavor_name|num_vcpus|memory|root_disk_size|ephemeral_disk_size|compute_name|os_type|os_version|block_storage_data -instarams.pickup.createheader.-vnfc.txt=vnfc_name|fqdn|tenant_id|operational_status|service_type|uuid_mate|vnfc_name_mate|vnfc_pool_id|vnf_name|vm_name|compute_name|application_vendor|application_type|application_name|application_version -instarams.pickup.createheader.-compute.txt=compute_name|loc_type|location_clli|storage_uuid|storage_name|storage_location|allocated_storage|zone -instarams.pickup.dir=/opt/aaihome/m63337/pickup -instarams.pnf.feeddir=/opt/aaihome/m39384/feed - -aai.auth.cspcookies_on=false -aai.dbmodel.filename=ex5.json -aai.server.url.base=https://mtanjv9aaas03.aic.cip.att.com:8443/aai/ -aai.server.url=https://mtanjv9aaas03.aic.cip.att.com:8443/aai/v7/ -aai.oldserver.url.base=https://mtanjv9aaas03.aic.cip.att.com:8443/aai/servers/ -aai.oldserver.url=https://mtanjv9aaas03.aic.cip.att.com:8443/aai/servers/v3/ -aai.truststore.filename=tomcat_keystore -aai.truststore.passwd.x=70c87528c88dcd9f9c2558d30e817868 -aai.keystore.filename=aai-client-cert.p12 -aai.keystore.passwd.x=70c87528c88dcd9f9c2558d30e817868 - -# the following parameters are not reloaded automatically and require a manual bounce -storage.backend=hbase -storage.hostname=mtanjv9aads07.aic.cip.att.com,mtanjv9aads08.aic.cip.att.com,mtanjv9aads09.aic.cip.att.com -#schema.default=none -storage.lock.wait-time=300 -storage.hbase.table=aaigraph-dev1.dev -storage.hbase.ext.zookeeper.znode.parent=/hbase-unsecure -# Setting db-cache to false ensure the fastest propagation of changes across servers -cache.db-cache = false -#cache.db-cache-clean-wait = 20 -#cache.db-cache-time = 180000 -#cache.db-cache-size = 0.5 - -# for transaction log -hbase.table.name=aailogging-dev1.dev -hbase.notificationTable.name=aainotification-dev1.dev -hbase.table.timestamp.format=YYYYMMdd-HH:mm:ss:SSS -hbase.zookeeper.quorum=mtanjv9aads07.aic.cip.att.com,mtanjv9aads08.aic.cip.att.com,mtanjv9aads09.aic.cip.att.com -hbase.zookeeper.property.clientPort=2181 -hbase.zookeeper.znode.parent=/hbase-unsecure - -# pin up a skeleton if it's not found -aai.precheck.v6.cloudinfrastructure.tenant.vserver.pserver=org.openecomp.aai.dbmapGen.v6.precheck.CloudInfrastructurePserverPrecheck -aai.precheck.v6.cloudinfrastructure.tenant.vserver.complex=org.openecomp.aai.dbmapGen.v6.precheck.CloudInfrastructureComplexPrecheck - -aai.precheck.v5.cloudinfrastructure.tenant.vserver.pserver=org.openecomp.aai.dbmapGen.v5.precheck.CloudInfrastructurePserverPrecheck -aai.precheck.v5.cloudinfrastructure.tenant.vserver.complex=org.openecomp.aai.dbmapGen.v5.precheck.CloudInfrastructureComplexPrecheck - -aai.precheck.v4.cloudinfrastructure.tenant.vserver.pserver=org.openecomp.aai.dbmapGen.v4.precheck.CloudInfrastructurePserverPrecheck -aai.precheck.v4.cloudinfrastructure.tenant.vserver.complex=org.openecomp.aai.dbmapGen.v4.precheck.CloudInfrastructureComplexPrecheck - -aai.precheck.cloudinfrastructure.complex.defaults.physicalLocationType=AAIDefault -aai.precheck.cloudinfrastructure.complex.defaults.street1=AAIDefault -aai.precheck.cloudinfrastructure.complex.defaults.city=AAIDefault -aai.precheck.cloudinfrastructure.complex.defaults.state=NJ -aai.precheck.cloudinfrastructure.complex.defaults.postalCode=07748 -aai.precheck.cloudinfrastructure.complex.defaults.country=USA -aai.precheck.cloudinfrastructure.complex.defaults.region=Americas - -#v4 extensions for ODL Notification -aai.extensions.v4.notify.odl.class=ODLNotification -aai.extensions.v4.notify.odlnotification.enabled=true - -#v3 extensions for ODL Notification -aai.extensions.v3.notify.odl.class=ODLNotification -aai.extensions.v3.notify.odlnotification.enabled=true - -#v5 extensions for ODL Notification -aai.extensions.v5.notify.odl.class=ODLNotification -aai.extensions.v5.notify.odlnotification.enabled=true - -#v6 extensions for ODL Notification -aai.extensions.v6.notify.odl.class=ODLNotification -aai.extensions.v6.notify.odlnotification.enabled=true - -# single primary server -aai.primary.filetransfer.serverlist=mtanjv9aaas03.aic.cip.att.com -aai.primary.filetransfer.primarycheck=echo:8443/aai/util/echo -aai.primary.filetransfer.pingtimeout=5000 -aai.primary.filetransfer.pingcount=5 - - -#INSTAR equipment status update -instar.equipstatus.host=dev-lpp.oss.att.com:55041 -instar.equipstatus.url=INSTAR/IPAGService -instar.equipstatus.timeout=20000 -instar.equipstatus.username=aai_ws -instar.equipstatus.password.x=dc911b84a32adbc9f5c8e53d701076b1 -instar.equipstatus.wssid=Id-qG1EkG7QHfaK_Hl7OYhRSROB -instar.equipstatus.soapaction="" -instar.equipstatus.aai-put-url=instar-ams/put/instar/equipment/ - -#rsync properties -aai.rsync.command=rsync -aai.rsync.options.list=-v|-t -aai.rsync.remote.user=aaiadmin -aai.rsync.enabled=y - -#Service Specific Data Values -aai.servicedescription.hostedcomm=HOSTED COMMUNICATIONS -aai.servicedescription.mobility=MOBILITY -aai.servicedescription.vusp=VIRTUAL USP -aai.servicedescription.ucpe=uCPE-VMS - -aai.notification.current.package=org.openecomp.aai.dbmapGen.v6 -aai.notification.current.version=v7 -aai.notificationEvent.default.status=UNPROCESSED -aai.notificationEvent.default.eventType=AAI-EVENT -aai.notificationEvent.default.domain=devINT1 -aai.notificationEvent.default.sourceName=aai -aai.notificationEvent.default.sequenceNumber=0 -aai.notificationEvent.default.severity=NORMAL -aai.notificationEvent.default.version=v7 -# This one lets us enable/disable resource-version checking on updates/deletes -aai.resourceversion.enableflag=true -aai.logging.maxStackTraceEntries=10 -aai.default.api.version=v7 - -aai.aic25.cloudregion.id=AAIAIC25 -aai.aic25.cloudregion.owner=att-aic - |