ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject [1/2] ambari git commit: AMBARI-14046. Refactor code that breaks transaction chaining. (mpapirkovskyy)
Date Tue, 24 Nov 2015 17:04:50 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 36dc7a0b7 -> 59c888536


AMBARI-14046. Refactor code that breaks transaction chaining. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/59c88853
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/59c88853
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/59c88853

Branch: refs/heads/trunk
Commit: 59c888536d444b82164f9b8a596fa5d92f870453
Parents: dffd776
Author: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Authored: Tue Nov 24 18:45:06 2015 +0200
Committer: Myroslav Papirkovskyy <mpapyrkovskyy@hortonworks.com>
Committed: Tue Nov 24 19:04:43 2015 +0200

----------------------------------------------------------------------
 .../server/controller/AmbariManagementControllerImpl.java      | 2 +-
 .../apache/ambari/server/controller/KerberosHelperImpl.java    | 2 +-
 .../server/events/listeners/alerts/AlertReceivedListener.java  | 2 +-
 .../org/apache/ambari/server/state/ServiceComponentImpl.java   | 2 +-
 .../main/java/org/apache/ambari/server/state/ServiceImpl.java  | 2 +-
 .../org/apache/ambari/server/state/cluster/ClustersImpl.java   | 4 ++--
 .../ambari/server/state/configgroup/ConfigGroupImpl.java       | 3 +--
 .../ambari/server/state/scheduler/RequestExecutionImpl.java    | 6 +++---
 .../server/state/svccomphost/ServiceComponentHostImpl.java     | 4 ++--
 .../org/apache/ambari/server/upgrade/StackUpgradeHelper.java   | 2 +-
 .../org/apache/ambari/server/upgrade/UpgradeCatalog210.java    | 2 +-
 .../main/java/org/apache/ambari/server/view/ViewRegistry.java  | 4 ++--
 .../ambari/server/scheduler/ExecutionScheduleManagerTest.java  | 2 +-
 .../java/org/apache/ambari/server/state/ConfigGroupTest.java   | 2 +-
 .../java/org/apache/ambari/server/state/ConfigHelperTest.java  | 2 +-
 .../org/apache/ambari/server/state/RequestExecutionTest.java   | 2 +-
 .../src/main/java/org/apache/ambari/scom/AmbariServer.java     | 2 +-
 17 files changed, 22 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
index 7cb7f7d..1e5b34e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariManagementControllerImpl.java
@@ -4326,7 +4326,7 @@ public class AmbariManagementControllerImpl implements AmbariManagementControlle
   }
 
   @Transactional
-  private void createWidgetsAndLayouts(Cluster cluster, List<WidgetLayout> widgetLayouts)
{
+  void createWidgetsAndLayouts(Cluster cluster, List<WidgetLayout> widgetLayouts) {
     String user = "ambari";
     Long clusterId = cluster.getClusterId();
     ClusterEntity clusterEntity = clusterDAO.findById(clusterId);

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
index ec322b4..3a050f4 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/KerberosHelperImpl.java
@@ -1050,7 +1050,7 @@ public class KerberosHelperImpl implements KerberosHelper {
    *                                               Kerberos-specific configuration details
    */
   @Transactional
-  private RequestStageContainer handle(Cluster cluster,
+  RequestStageContainer handle(Cluster cluster,
                                        KerberosDetails kerberosDetails,
                                        Map<String, ? extends Collection<String>>
serviceComponentFilter,
                                        Set<String> hostFilter, Collection<String>
identityFilter,

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
index 402af5c..9bbfe37 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertReceivedListener.java
@@ -268,7 +268,7 @@ public class AlertReceivedListener {
    * @param toCreateHistoryAndMerge - create new history, merge alert
    */
   @Transactional
-  private void saveEntities(Map<Alert, AlertCurrentEntity> toCreate,
+  void saveEntities(Map<Alert, AlertCurrentEntity> toCreate,
       Map<Alert, AlertCurrentEntity> toMerge,
       Map<Alert, AlertCurrentEntity> toCreateHistoryAndMerge) {
     for (Map.Entry<Alert, AlertCurrentEntity> entry : toCreate.entrySet()) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
index 8673f8f..7e1dd1d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceComponentImpl.java
@@ -564,7 +564,7 @@ public class ServiceComponentImpl implements ServiceComponent {
    * has already been acquired from {@link #readWriteLock}.
    */
   @Transactional
-  private void saveIfPersisted() {
+  void saveIfPersisted() {
     if (isPersisted()) {
       serviceComponentDesiredStateDAO.merge(desiredStateEntity);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
index c13455a..0a998df 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceImpl.java
@@ -506,7 +506,7 @@ public class ServiceImpl implements Service {
   }
 
   @Transactional
-  private void saveIfPersisted() {
+  void saveIfPersisted() {
     if (isPersisted()) {
       clusterServiceDAO.merge(serviceEntity);
       serviceDesiredStateDAO.merge(serviceDesiredStateEntity);

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
index b89a8c4..f735a3c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClustersImpl.java
@@ -180,7 +180,7 @@ public class ClustersImpl implements Clusters {
   }
 
   @Transactional
-  private void loadClustersAndHosts() {
+  void loadClustersAndHosts() {
     for (ClusterEntity clusterEntity : clusterDAO.findAll()) {
       Cluster currentCluster = clusterFactory.create(clusterEntity);
       clusters.put(clusterEntity.getClusterName(), currentCluster);
@@ -588,7 +588,7 @@ public class ClustersImpl implements Clusters {
   }
 
   @Transactional
-  private void mapHostClusterEntities(String hostName, Long clusterId) {
+  void mapHostClusterEntities(String hostName, Long clusterId) {
     HostEntity hostEntity = hostDAO.findByName(hostName);
     ClusterEntity clusterEntity = clusterDAO.findById(clusterId);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
index 8b488a7..1d6b1e8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/configgroup/ConfigGroupImpl.java
@@ -458,13 +458,12 @@ public class ConfigGroupImpl implements ConfigGroup {
   }
 
   @Transactional
-  private void save(ClusterEntity clusterEntity) {
+  void save(ClusterEntity clusterEntity) {
     persistHostMapping();
     persistConfigMapping(clusterEntity);
   }
 
   @Override
-  @Transactional
   public void delete() {
     cluster.getClusterGlobalLock().writeLock().lock();
     try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java
index dcc9440..895579e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/scheduler/RequestExecutionImpl.java
@@ -247,7 +247,7 @@ public class RequestExecutionImpl implements RequestExecution {
    * Persist @RequestScheduleEntity with @RequestScheduleBatchHostEntity
    */
   @Transactional
-  private void persistEntities() {
+  void persistEntities() {
     ClusterEntity clusterEntity = clusterDAO.findById(cluster.getClusterId());
     requestScheduleEntity.setClusterEntity(clusterEntity);
     requestScheduleEntity.setCreateTimestamp(System.currentTimeMillis());
@@ -258,7 +258,7 @@ public class RequestExecutionImpl implements RequestExecution {
   }
 
   @Transactional
-  private void persistRequestMapping() {
+  void persistRequestMapping() {
     // Delete existing mappings to support updates
     if (isPersisted) {
       batchRequestDAO.removeByScheduleId(requestScheduleEntity.getScheduleId());
@@ -293,7 +293,7 @@ public class RequestExecutionImpl implements RequestExecution {
   }
 
   @Transactional
-  private void saveIfPersisted() {
+  void saveIfPersisted() {
     if (isPersisted) {
       requestScheduleEntity.setUpdateTimestamp(System.currentTimeMillis());
       // Update the Entity object with new settings

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
index 21daed0..ff41079 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java
@@ -1466,7 +1466,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost
{
    * from {@link #readWriteLock}.
    */
   @Transactional
-  private void saveIfPersisted() {
+  void saveIfPersisted() {
     if (isPersisted()) {
       hostComponentStateDAO.merge(stateEntity);
       hostComponentDesiredStateDAO.merge(desiredStateEntity);
@@ -1705,7 +1705,7 @@ public class ServiceComponentHostImpl implements ServiceComponentHost
{
   }
 
   @Transactional
-  private RepositoryVersionEntity createRepositoryVersion(String version, final StackId stackId,
final StackInfo stackInfo) throws AmbariException {
+  RepositoryVersionEntity createRepositoryVersion(String version, final StackId stackId,
final StackInfo stackInfo) throws AmbariException {
     // During an Ambari Upgrade from 1.7.0 -> 2.0.0, the Repo Version will not exist,
so bootstrap it.
     LOG.info("Creating new repository version " + stackId.getStackName() + "-" + version);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/upgrade/StackUpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/StackUpgradeHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/StackUpgradeHelper.java
index 77ec069..b1c643a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/StackUpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/StackUpgradeHelper.java
@@ -71,7 +71,7 @@ public class StackUpgradeHelper {
    * @throws SQLException
    */
   @Transactional
-  private void updateMetaInfo(Map<String, String> data) throws SQLException {
+  void updateMetaInfo(Map<String, String> data) throws SQLException {
     if (data != null && !data.isEmpty()) {
       for (Map.Entry<String, String> entry : data.entrySet()) {
         MetainfoEntity metainfoEntity = metainfoDAO.findByKey(entry.getKey());

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
index ba8267c..233019a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog210.java
@@ -840,7 +840,7 @@ public class UpgradeCatalog210 extends AbstractUpgradeCatalog {
    * @throws SQLException
    */
   @Transactional
-  private Long populateHostsId(ResultSet resultSet) throws SQLException {
+  Long populateHostsId(ResultSet resultSet) throws SQLException {
     Long hostId = 0L;
     if (resultSet != null) {
       try {

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
index c1c554c..d4ceb23 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
@@ -1355,7 +1355,7 @@ public class ViewRegistry {
 
   // create an admin resource for the given view instance entity and merge it
   @Transactional
-  private ViewInstanceEntity mergeViewInstance(ViewInstanceEntity instanceEntity, ResourceTypeEntity
resourceTypeEntity) {
+  ViewInstanceEntity mergeViewInstance(ViewInstanceEntity instanceEntity, ResourceTypeEntity
resourceTypeEntity) {
     // create an admin resource to represent this view instance
     instanceEntity.setResource(createViewInstanceResource(resourceTypeEntity));
 
@@ -1610,7 +1610,7 @@ public class ViewRegistry {
 
   // persist the given view and its instances
   @Transactional
-  private void persistView(ViewEntity viewDefinition, Set<ViewInstanceEntity> instanceDefinitions)
throws Exception {
+  void persistView(ViewEntity viewDefinition, Set<ViewInstanceEntity> instanceDefinitions)
throws Exception {
     // ensure that the view entity matches the db
     syncView(viewDefinition, instanceDefinitions);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
index 9de932a..2f97eeb 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
@@ -163,7 +163,7 @@ public class ExecutionScheduleManagerTest {
   }
 
   @Transactional
-  private RequestExecution createRequestExecution(boolean addSchedule)
+  RequestExecution createRequestExecution(boolean addSchedule)
       throws Exception {
     Batch batches = new Batch();
     Schedule schedule = new Schedule();

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
index 5f92094..02ce9fb 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
@@ -85,7 +85,7 @@ public class ConfigGroupTest {
   }
 
   @Transactional
-  private ConfigGroup createConfigGroup() throws AmbariException {
+  ConfigGroup createConfigGroup() throws AmbariException {
     // Create config without persisting and save group
     Map<String, String> properties = new HashMap<String, String>();
     properties.put("a", "b");

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
index 06c99f4..bdb5156 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java
@@ -192,7 +192,7 @@ public class ConfigHelperTest {
     }
 
     @Transactional
-    private Long addConfigGroup(String name, String tag, List<String> hosts,
+    Long addConfigGroup(String name, String tag, List<String> hosts,
                                 List<Config> configs) throws AmbariException {
 
       Map<Long, Host> hostMap = new HashMap<Long, Host>();

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
index 46dcc8d..a5b0e5a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
@@ -85,7 +85,7 @@ public class RequestExecutionTest {
   }
 
   @Transactional
-  private RequestExecution createRequestSchedule() throws Exception {
+  RequestExecution createRequestSchedule() throws Exception {
     Batch batches = new Batch();
     Schedule schedule = new Schedule();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/59c88853/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/AmbariServer.java
----------------------------------------------------------------------
diff --git a/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/AmbariServer.java
b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/AmbariServer.java
index 9b36ca5..544dafc 100644
--- a/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/AmbariServer.java
+++ b/contrib/ambari-scom/ambari-scom-server/src/main/java/org/apache/ambari/scom/AmbariServer.java
@@ -305,7 +305,7 @@ public class AmbariServer {
 
   // Creates default users and roles if in-memory database is used
   @Transactional
-  private void addInMemoryUsers() {
+  void addInMemoryUsers() {
     if (getPersistenceType(configuration) == PersistenceType.IN_MEMORY &&
         configuration.getApiAuthentication()) {
       LOG.info("In-memory database is used - creating default users");


Mime
View raw message