Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
0a81c250
Commit
0a81c250
authored
6 years ago
by
nixonrodrigues
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3129 Fix SSL Truststore reloader leak from AtlasBaseClient
Change-Id: I5af8c26a41a7010de645ddaa6869c3ce15723f43
parent
4d6169f5
master
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
76 additions
and
18 deletions
+76
-18
HBaseBridge.java
.../main/java/org/apache/atlas/hbase/bridge/HBaseBridge.java
+5
-2
HiveMetaStoreBridge.java
...ava/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
+5
-1
KafkaBridge.java
.../main/java/org/apache/atlas/kafka/bridge/KafkaBridge.java
+5
-1
AtlasBaseClient.java
...ommon/src/main/java/org/apache/atlas/AtlasBaseClient.java
+11
-2
SecureClientUtils.java
...ain/java/org/apache/atlas/security/SecureClientUtils.java
+23
-9
QuickStart.java
...p/src/main/java/org/apache/atlas/examples/QuickStart.java
+13
-1
QuickStartV2.java
...src/main/java/org/apache/atlas/examples/QuickStartV2.java
+14
-2
No files found.
addons/hbase-bridge/src/main/java/org/apache/atlas/hbase/bridge/HBaseBridge.java
View file @
0a81c250
...
@@ -42,7 +42,6 @@ import org.apache.hadoop.hbase.HBaseConfiguration;
...
@@ -42,7 +42,6 @@ import org.apache.hadoop.hbase.HBaseConfiguration;
import
org.apache.hadoop.hbase.NamespaceDescriptor
;
import
org.apache.hadoop.hbase.NamespaceDescriptor
;
import
org.apache.hadoop.hbase.client.Admin
;
import
org.apache.hadoop.hbase.client.Admin
;
import
org.apache.hadoop.hbase.client.ColumnFamilyDescriptor
;
import
org.apache.hadoop.hbase.client.ColumnFamilyDescriptor
;
import
org.apache.hadoop.hbase.client.ColumnFamilyDescriptor
;
import
org.apache.hadoop.hbase.client.Connection
;
import
org.apache.hadoop.hbase.client.Connection
;
import
org.apache.hadoop.hbase.client.ConnectionFactory
;
import
org.apache.hadoop.hbase.client.ConnectionFactory
;
import
org.apache.hadoop.hbase.client.HBaseAdmin
;
import
org.apache.hadoop.hbase.client.HBaseAdmin
;
...
@@ -123,6 +122,7 @@ public class HBaseBridge {
...
@@ -123,6 +122,7 @@ public class HBaseBridge {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
int
exitCode
=
EXIT_CODE_FAILED
;
int
exitCode
=
EXIT_CODE_FAILED
;
AtlasClientV2
atlasClientV2
=
null
;
try
{
try
{
Options
options
=
new
Options
();
Options
options
=
new
Options
();
...
@@ -142,7 +142,6 @@ public class HBaseBridge {
...
@@ -142,7 +142,6 @@ public class HBaseBridge {
urls
=
new
String
[]
{
DEFAULT_ATLAS_URL
};
urls
=
new
String
[]
{
DEFAULT_ATLAS_URL
};
}
}
final
AtlasClientV2
atlasClientV2
;
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
String
[]
basicAuthUsernamePassword
=
AuthenticationUtil
.
getBasicAuthenticationInput
();
String
[]
basicAuthUsernamePassword
=
AuthenticationUtil
.
getBasicAuthenticationInput
();
...
@@ -195,6 +194,10 @@ public class HBaseBridge {
...
@@ -195,6 +194,10 @@ public class HBaseBridge {
System
.
out
.
println
(
"ImportHBaseEntities failed. Please check the log file for the detailed error message"
);
System
.
out
.
println
(
"ImportHBaseEntities failed. Please check the log file for the detailed error message"
);
LOG
.
error
(
"ImportHBaseEntities failed"
,
e
);
LOG
.
error
(
"ImportHBaseEntities failed"
,
e
);
}
finally
{
if
(
atlasClientV2
!=
null
)
{
atlasClientV2
.
close
();
}
}
}
System
.
exit
(
exitCode
);
System
.
exit
(
exitCode
);
...
...
This diff is collapsed.
Click to expand it.
addons/hive-bridge/src/main/java/org/apache/atlas/hive/bridge/HiveMetaStoreBridge.java
View file @
0a81c250
...
@@ -103,6 +103,7 @@ public class HiveMetaStoreBridge {
...
@@ -103,6 +103,7 @@ public class HiveMetaStoreBridge {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
int
exitCode
=
EXIT_CODE_FAILED
;
int
exitCode
=
EXIT_CODE_FAILED
;
AtlasClientV2
atlasClientV2
=
null
;
try
{
try
{
Options
options
=
new
Options
();
Options
options
=
new
Options
();
...
@@ -123,7 +124,6 @@ public class HiveMetaStoreBridge {
...
@@ -123,7 +124,6 @@ public class HiveMetaStoreBridge {
atlasEndpoint
=
new
String
[]
{
DEFAULT_ATLAS_URL
};
atlasEndpoint
=
new
String
[]
{
DEFAULT_ATLAS_URL
};
}
}
final
AtlasClientV2
atlasClientV2
;
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
String
[]
basicAuthUsernamePassword
=
AuthenticationUtil
.
getBasicAuthenticationInput
();
String
[]
basicAuthUsernamePassword
=
AuthenticationUtil
.
getBasicAuthenticationInput
();
...
@@ -174,6 +174,10 @@ public class HiveMetaStoreBridge {
...
@@ -174,6 +174,10 @@ public class HiveMetaStoreBridge {
printUsage
();
printUsage
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Import failed"
,
e
);
LOG
.
error
(
"Import failed"
,
e
);
}
finally
{
if
(
atlasClientV2
!=
null
)
{
atlasClientV2
.
close
();
}
}
}
System
.
exit
(
exitCode
);
System
.
exit
(
exitCode
);
...
...
This diff is collapsed.
Click to expand it.
addons/kafka-bridge/src/main/java/org/apache/atlas/kafka/bridge/KafkaBridge.java
View file @
0a81c250
...
@@ -88,6 +88,7 @@ public class KafkaBridge {
...
@@ -88,6 +88,7 @@ public class KafkaBridge {
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
int
exitCode
=
EXIT_CODE_FAILED
;
int
exitCode
=
EXIT_CODE_FAILED
;
AtlasClientV2
atlasClientV2
=
null
;
try
{
try
{
Options
options
=
new
Options
();
Options
options
=
new
Options
();
...
@@ -105,7 +106,6 @@ public class KafkaBridge {
...
@@ -105,7 +106,6 @@ public class KafkaBridge {
urls
=
new
String
[]
{
DEFAULT_ATLAS_URL
};
urls
=
new
String
[]
{
DEFAULT_ATLAS_URL
};
}
}
final
AtlasClientV2
atlasClientV2
;
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
String
[]
basicAuthUsernamePassword
=
AuthenticationUtil
.
getBasicAuthenticationInput
();
String
[]
basicAuthUsernamePassword
=
AuthenticationUtil
.
getBasicAuthenticationInput
();
...
@@ -148,6 +148,10 @@ public class KafkaBridge {
...
@@ -148,6 +148,10 @@ public class KafkaBridge {
System
.
out
.
println
(
"ImportKafkaEntities failed. Please check the log file for the detailed error message"
);
System
.
out
.
println
(
"ImportKafkaEntities failed. Please check the log file for the detailed error message"
);
e
.
printStackTrace
();
e
.
printStackTrace
();
LOG
.
error
(
"ImportKafkaEntities failed"
,
e
);
LOG
.
error
(
"ImportKafkaEntities failed"
,
e
);
}
finally
{
if
(
atlasClientV2
!=
null
)
{
atlasClientV2
.
close
();
}
}
}
System
.
exit
(
exitCode
);
System
.
exit
(
exitCode
);
...
...
This diff is collapsed.
Click to expand it.
client/common/src/main/java/org/apache/atlas/AtlasBaseClient.java
View file @
0a81c250
...
@@ -114,6 +114,8 @@ public abstract class AtlasBaseClient {
...
@@ -114,6 +114,8 @@ public abstract class AtlasBaseClient {
private
boolean
retryEnabled
=
false
;
private
boolean
retryEnabled
=
false
;
private
Cookie
cookie
=
null
;
private
Cookie
cookie
=
null
;
private
SecureClientUtils
clientUtils
;
protected
AtlasBaseClient
()
{
protected
AtlasBaseClient
()
{
}
}
...
@@ -282,14 +284,15 @@ public abstract class AtlasBaseClient {
...
@@ -282,14 +284,15 @@ public abstract class AtlasBaseClient {
}
}
final
URLConnectionClientHandler
handler
;
final
URLConnectionClientHandler
handler
;
clientUtils
=
new
SecureClientUtils
();
boolean
isKerberosEnabled
=
AuthenticationUtil
.
isKerberosAuthenticationEnabled
(
ugi
);
boolean
isKerberosEnabled
=
AuthenticationUtil
.
isKerberosAuthenticationEnabled
(
ugi
);
if
(
isKerberosEnabled
)
{
if
(
isKerberosEnabled
)
{
handler
=
SecureC
lientUtils
.
getClientConnectionHandler
(
config
,
configuration
,
doAsUser
,
ugi
);
handler
=
c
lientUtils
.
getClientConnectionHandler
(
config
,
configuration
,
doAsUser
,
ugi
);
}
else
{
}
else
{
if
(
configuration
.
getBoolean
(
TLS_ENABLED
,
false
))
{
if
(
configuration
.
getBoolean
(
TLS_ENABLED
,
false
))
{
handler
=
SecureC
lientUtils
.
getUrlConnectionClientHandler
();
handler
=
c
lientUtils
.
getUrlConnectionClientHandler
();
}
else
{
}
else
{
handler
=
new
URLConnectionClientHandler
();
handler
=
new
URLConnectionClientHandler
();
}
}
...
@@ -300,6 +303,12 @@ public abstract class AtlasBaseClient {
...
@@ -300,6 +303,12 @@ public abstract class AtlasBaseClient {
return
client
;
return
client
;
}
}
public
void
close
()
{
if
(
clientUtils
!=
null
)
{
clientUtils
.
destroyFactory
();
}
}
@VisibleForTesting
@VisibleForTesting
protected
String
determineActiveServiceURL
(
String
[]
baseUrls
,
Client
client
)
{
protected
String
determineActiveServiceURL
(
String
[]
baseUrls
,
Client
client
)
{
if
(
baseUrls
.
length
==
0
)
{
if
(
baseUrls
.
length
==
0
)
{
...
...
This diff is collapsed.
Click to expand it.
client/common/src/main/java/org/apache/atlas/security/SecureClientUtils.java
View file @
0a81c250
...
@@ -57,9 +57,10 @@ public class SecureClientUtils {
...
@@ -57,9 +57,10 @@ public class SecureClientUtils {
public
final
static
int
DEFAULT_SOCKET_TIMEOUT_IN_MSECS
=
1
*
60
*
1000
;
// 1 minute
public
final
static
int
DEFAULT_SOCKET_TIMEOUT_IN_MSECS
=
1
*
60
*
1000
;
// 1 minute
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
SecureClientUtils
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
SecureClientUtils
.
class
);
private
SSLFactory
factory
=
null
;
public
static
URLConnectionClientHandler
getClientConnectionHandler
(
DefaultClientConfig
config
,
public
URLConnectionClientHandler
getClientConnectionHandler
(
DefaultClientConfig
config
,
org
.
apache
.
commons
.
configuration
.
Configuration
clientConfig
,
String
doAsUser
,
org
.
apache
.
commons
.
configuration
.
Configuration
clientConfig
,
String
doAsUser
,
final
UserGroupInformation
ugi
)
{
final
UserGroupInformation
ugi
)
{
config
.
getProperties
().
put
(
URLConnectionClientHandler
.
PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND
,
true
);
config
.
getProperties
().
put
(
URLConnectionClientHandler
.
PROPERTY_HTTP_URL_CONNECTION_SET_METHOD_WORKAROUND
,
true
);
...
@@ -125,7 +126,7 @@ public class SecureClientUtils {
...
@@ -125,7 +126,7 @@ public class SecureClientUtils {
}
}
};
};
private
static
ConnectionConfigurator
newConnConfigurator
(
Configuration
conf
)
{
private
ConnectionConfigurator
newConnConfigurator
(
Configuration
conf
)
{
try
{
try
{
return
newSslConnConfigurator
(
DEFAULT_SOCKET_TIMEOUT_IN_MSECS
,
conf
);
return
newSslConnConfigurator
(
DEFAULT_SOCKET_TIMEOUT_IN_MSECS
,
conf
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -134,14 +135,12 @@ public class SecureClientUtils {
...
@@ -134,14 +135,12 @@ public class SecureClientUtils {
}
}
}
}
private
static
ConnectionConfigurator
newSslConnConfigurator
(
final
int
timeout
,
Configuration
conf
)
private
ConnectionConfigurator
newSslConnConfigurator
(
final
int
timeout
,
Configuration
conf
)
throws
IOException
,
GeneralSecurityException
{
throws
IOException
,
GeneralSecurityException
{
final
SSLFactory
factory
;
final
SSLSocketFactory
sf
;
final
SSLSocketFactory
sf
;
final
HostnameVerifier
hv
;
final
HostnameVerifier
hv
;
factory
=
new
SSLFactory
(
SSLFactory
.
Mode
.
CLIENT
,
conf
);
factory
=
getSSLFactory
(
conf
);
factory
.
init
();
sf
=
factory
.
createSSLSocketFactory
();
sf
=
factory
.
createSSLSocketFactory
();
hv
=
factory
.
getHostnameVerifier
();
hv
=
factory
.
getHostnameVerifier
();
...
@@ -159,6 +158,22 @@ public class SecureClientUtils {
...
@@ -159,6 +158,22 @@ public class SecureClientUtils {
};
};
}
}
public
SSLFactory
getSSLFactory
(
Configuration
conf
)
throws
IOException
,
GeneralSecurityException
{
if
(
factory
==
null
)
{
factory
=
new
SSLFactory
(
SSLFactory
.
Mode
.
CLIENT
,
conf
);
factory
.
init
();
}
return
factory
;
}
public
void
destroyFactory
()
{
if
(
factory
!=
null
)
{
factory
.
destroy
();
factory
=
null
;
}
}
private
static
void
setTimeouts
(
URLConnection
connection
,
int
socketTimeout
)
{
private
static
void
setTimeouts
(
URLConnection
connection
,
int
socketTimeout
)
{
connection
.
setConnectTimeout
(
socketTimeout
);
connection
.
setConnectTimeout
(
socketTimeout
);
connection
.
setReadTimeout
(
socketTimeout
);
connection
.
setReadTimeout
(
socketTimeout
);
...
@@ -210,7 +225,7 @@ public class SecureClientUtils {
...
@@ -210,7 +225,7 @@ public class SecureClientUtils {
}
}
}
}
public
static
URLConnectionClientHandler
getUrlConnectionClientHandler
()
{
public
URLConnectionClientHandler
getUrlConnectionClientHandler
()
{
return
new
URLConnectionClientHandler
(
new
HttpURLConnectionFactory
()
{
return
new
URLConnectionClientHandler
(
new
HttpURLConnectionFactory
()
{
@Override
@Override
public
HttpURLConnection
getHttpURLConnection
(
URL
url
)
public
HttpURLConnection
getHttpURLConnection
(
URL
url
)
...
@@ -230,8 +245,7 @@ public class SecureClientUtils {
...
@@ -230,8 +245,7 @@ public class SecureClientUtils {
UserGroupInformation
.
setConfiguration
(
conf
);
UserGroupInformation
.
setConfiguration
(
conf
);
HttpsURLConnection
c
=
(
HttpsURLConnection
)
connection
;
HttpsURLConnection
c
=
(
HttpsURLConnection
)
connection
;
factory
=
new
SSLFactory
(
SSLFactory
.
Mode
.
CLIENT
,
conf
);
factory
=
getSSLFactory
(
conf
);
factory
.
init
();
sf
=
factory
.
createSSLSocketFactory
();
sf
=
factory
.
createSSLSocketFactory
();
hv
=
factory
.
getHostnameVerifier
();
hv
=
factory
.
getHostnameVerifier
();
c
.
setSSLSocketFactory
(
sf
);
c
.
setSSLSocketFactory
(
sf
);
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/examples/QuickStart.java
View file @
0a81c250
...
@@ -77,8 +77,9 @@ public class QuickStart {
...
@@ -77,8 +77,9 @@ public class QuickStart {
@VisibleForTesting
@VisibleForTesting
static
void
runQuickstart
(
String
[]
args
,
String
[]
basicAuthUsernamePassword
)
throws
Exception
{
static
void
runQuickstart
(
String
[]
args
,
String
[]
basicAuthUsernamePassword
)
throws
Exception
{
String
[]
urls
=
getServerUrl
(
args
);
String
[]
urls
=
getServerUrl
(
args
);
QuickStart
quickStart
;
QuickStart
quickStart
=
null
;
try
{
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
quickStart
=
new
QuickStart
(
urls
,
basicAuthUsernamePassword
);
quickStart
=
new
QuickStart
(
urls
,
basicAuthUsernamePassword
);
}
else
{
}
else
{
...
@@ -93,6 +94,11 @@ public class QuickStart {
...
@@ -93,6 +94,11 @@ public class QuickStart {
// Shows some search queries using DSL based on types
// Shows some search queries using DSL based on types
quickStart
.
search
();
quickStart
.
search
();
}
finally
{
if
(
quickStart
!=
null
)
{
quickStart
.
closeConnection
();
}
}
}
}
static
String
[]
getServerUrl
(
String
[]
args
)
throws
AtlasException
{
static
String
[]
getServerUrl
(
String
[]
args
)
throws
AtlasException
{
...
@@ -492,4 +498,10 @@ public class QuickStart {
...
@@ -492,4 +498,10 @@ public class QuickStart {
throw
new
AtlasBaseException
(
AtlasErrorCode
.
QUICK_START
,
e
,
"one or more dsl queries failed"
);
throw
new
AtlasBaseException
(
AtlasErrorCode
.
QUICK_START
,
e
,
"one or more dsl queries failed"
);
}
}
}
}
private
void
closeConnection
()
{
if
(
metadataServiceClient
!=
null
)
{
metadataServiceClient
.
close
();
}
}
}
}
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/examples/QuickStartV2.java
View file @
0a81c250
...
@@ -151,8 +151,8 @@ public class QuickStartV2 {
...
@@ -151,8 +151,8 @@ public class QuickStartV2 {
static
void
runQuickstart
(
String
[]
args
,
String
[]
basicAuthUsernamePassword
)
throws
Exception
{
static
void
runQuickstart
(
String
[]
args
,
String
[]
basicAuthUsernamePassword
)
throws
Exception
{
String
[]
urls
=
getServerUrl
(
args
);
String
[]
urls
=
getServerUrl
(
args
);
QuickStartV2
quickStartV2
;
QuickStartV2
quickStartV2
=
null
;
try
{
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
if
(!
AuthenticationUtil
.
isKerberosAuthenticationEnabled
())
{
quickStartV2
=
new
QuickStartV2
(
urls
,
basicAuthUsernamePassword
);
quickStartV2
=
new
QuickStartV2
(
urls
,
basicAuthUsernamePassword
);
}
else
{
}
else
{
...
@@ -170,6 +170,11 @@ public class QuickStartV2 {
...
@@ -170,6 +170,11 @@ public class QuickStartV2 {
// Shows some lineage information on entity
// Shows some lineage information on entity
quickStartV2
.
lineage
();
quickStartV2
.
lineage
();
}
finally
{
if
(
quickStartV2
!=
null
)
{
quickStartV2
.
closeConnection
();
}
}
}
}
...
@@ -647,4 +652,10 @@ public class QuickStartV2 {
...
@@ -647,4 +652,10 @@ public class QuickStartV2 {
return
tableEntity
.
getGuid
();
return
tableEntity
.
getGuid
();
}
}
private
void
closeConnection
()
{
if
(
atlasClientV2
!=
null
)
{
atlasClientV2
.
close
();
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment