001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.backgroundtask;
016    
017    /**
018     * @author Michael C. Han
019     */
020    public class DelegatingBackgroundTaskExecutor
021            implements BackgroundTaskExecutor {
022    
023            public DelegatingBackgroundTaskExecutor(
024                    BackgroundTaskExecutor backgroundTaskExecutor) {
025    
026                    _backgroundTaskExecutor = backgroundTaskExecutor;
027            }
028    
029            @Override
030            public BackgroundTaskExecutor clone() {
031                    BackgroundTaskExecutor backgroundTaskExecutor =
032                            new DelegatingBackgroundTaskExecutor(getBackgroundTaskExecutor());
033    
034                    return backgroundTaskExecutor;
035            }
036    
037            @Override
038            public BackgroundTaskResult execute(BackgroundTask backgroundTask)
039                    throws Exception {
040    
041                    return _backgroundTaskExecutor.execute(backgroundTask);
042            }
043    
044            @Override
045            public BackgroundTaskStatusMessageTranslator
046                    getBackgroundTaskStatusMessageTranslator() {
047    
048                    return _backgroundTaskExecutor.
049                            getBackgroundTaskStatusMessageTranslator();
050            }
051    
052            @Override
053            public int getIsolationLevel() {
054                    return _backgroundTaskExecutor.getIsolationLevel();
055            }
056    
057            @Override
058            public String handleException(BackgroundTask backgroundTask, Exception e) {
059                    return _backgroundTaskExecutor.handleException(backgroundTask, e);
060            }
061    
062            @Override
063            public boolean isSerial() {
064                    return _backgroundTaskExecutor.isSerial();
065            }
066    
067            protected BackgroundTaskExecutor getBackgroundTaskExecutor() {
068                    return _backgroundTaskExecutor;
069            }
070    
071            private final BackgroundTaskExecutor _backgroundTaskExecutor;
072    
073    }