2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
8 * Modifications Copyright © 2018 IBM.
9 * ===================================================================
11 * Unless otherwise specified, all software contained herein is licensed
12 * under the Apache License, Version 2.0 (the "License");
13 * you may not use this software except in compliance with the License.
14 * You may obtain a copy of the License at
16 * http://www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
24 * Unless otherwise specified, all documentation contained herein is licensed
25 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
26 * you may not use this documentation except in compliance with the License.
27 * You may obtain a copy of the License at
29 * https://creativecommons.org/licenses/by/4.0/
31 * Unless required by applicable law or agreed to in writing, documentation
32 * distributed under the License is distributed on an "AS IS" BASIS,
33 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34 * See the License for the specific language governing permissions and
35 * limitations under the License.
37 * ============LICENSE_END============================================
41 package org.onap.portalapp.config;
43 import org.springframework.context.ApplicationContext;
44 import org.springframework.context.ApplicationContextAware;
45 import org.springframework.context.annotation.Bean;
46 import org.springframework.context.annotation.Configuration;
48 import javax.annotation.PostConstruct;
49 import java.util.Timer;
50 import java.util.TimerTask;
53 public class NotificationCleanupConfig implements ApplicationContextAware {
55 // Once every 10 minutes should be adequate
56 public static final int CLEANUP_PERIOD_MINUTES = 10;
58 private static ApplicationContext applicationContext;
60 public void setApplicationContext(ApplicationContext context) {
61 applicationContext = context;
64 public static ApplicationContext getApplicationContext() {
65 return applicationContext;
70 public void StartSchedular() {
71 TimerTask task = new NotificationCleanup();
72 Timer timer = new Timer();
73 timer.schedule(task, 1000, (long) CLEANUP_PERIOD_MINUTES * 60 * 1000);
77 public NotificationCleanupConfig getConfig() {
78 return new NotificationCleanupConfig();