-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
167 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/** | ||
* Copyright 2009-2015 the original author or authors. | ||
* <p> | ||
* 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 | ||
* <p> | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* <p> | ||
* 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. | ||
*/ | ||
package org.apache.ibatis.exceptions; | ||
|
||
/** | ||
* mybatis 异常 | ||
* @author Clinton Begin | ||
*/ | ||
@SuppressWarnings("deprecation") | ||
public class PersistenceException extends IbatisException { | ||
|
||
private static final long serialVersionUID = -7537395265357977271L; | ||
|
||
public PersistenceException() { | ||
super(); | ||
} | ||
|
||
public PersistenceException(String message) { | ||
super(message); | ||
} | ||
|
||
public PersistenceException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public PersistenceException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
package com.huifer.jdk.thread; | ||
|
||
import java.util.concurrent.CompletionService; | ||
import java.util.concurrent.ExecutorCompletionService; | ||
import java.util.concurrent.ExecutorService; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
/** | ||
* <p>Title : SpringLoad2 </p> | ||
* <p>Description : </p> | ||
* | ||
* @author huifer | ||
* @date 2019-05-27 | ||
*/ | ||
public class SpringLoad2 { | ||
|
||
public static void main(String[] args) { | ||
SpringLoad2 springLoad2 = new SpringLoad2(); | ||
springLoad2.loadProject(); | ||
} | ||
|
||
public void loadProject() { | ||
try { | ||
long start = System.currentTimeMillis(); | ||
ExecutorService service = Executors.newFixedThreadPool(3); | ||
CompletionService completionService = new ExecutorCompletionService(service); | ||
|
||
completionService.submit(this::loadSpringMvc, null); | ||
completionService.submit(this::loadMyBatis, null); | ||
completionService.submit(this::loadSpring, null); | ||
|
||
|
||
int count = 0; | ||
while (count < 3) { | ||
if (completionService.poll() != null) { | ||
count++; | ||
} | ||
} | ||
|
||
service.shutdown(); | ||
System.out.println(System.currentTimeMillis() - start); | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
|
||
} | ||
} | ||
|
||
|
||
private void loadSpringMvc() { | ||
loadXML("spring-mvc.xml", 1); | ||
} | ||
|
||
|
||
private void loadMyBatis() { | ||
loadXML("mybatis.xml", 2); | ||
} | ||
|
||
private void loadSpring() { | ||
loadXML("spring.xml", 3); | ||
} | ||
|
||
|
||
/*** | ||
* 加载文件 | ||
* @param xml | ||
* @param loadSec | ||
*/ | ||
private void loadXML(String xml, int loadSec) { | ||
try { | ||
long startTime = System.currentTimeMillis(); | ||
long milliseconds = TimeUnit.SECONDS.toMillis(loadSec); | ||
Thread.sleep(milliseconds); | ||
long endTime = System.currentTimeMillis(); | ||
|
||
System.out.printf("[线程 : %s] 加载%s 耗时: %d 毫秒\n", | ||
Thread.currentThread().getName(), | ||
xml, | ||
endTime - startTime | ||
); | ||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
|
||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.huifer.utils.factory; | ||
|
||
public class AbsTransform { | ||
private Object value; | ||
|
||
public Object getValue() { | ||
return value; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.huifer.design.adapter.login; | ||
|
||
/** | ||
* <p>Title : LoginTest </p> | ||
* <p>Description : </p> | ||
* | ||
* @author huifer | ||
* @date 2019-05-21 | ||
*/ | ||
public class LoginTest { | ||
|
||
public static void main(String[] args) { | ||
LoginService loginService = new LoginService(); | ||
ResultMsg registA = loginService.regist("a", "1"); | ||
System.out.println(registA); | ||
ResultMsg loginA = loginService.login("a", "1"); | ||
System.out.println(loginA); | ||
|
||
NewLoginService newLoginService = new NewLoginService(); | ||
ResultMsg resultMsg = newLoginService.loginForQQ("QQ登陆测试"); | ||
System.out.println(resultMsg); | ||
|
||
System.out.println(LoginService.menberList); | ||
|
||
} | ||
|
||
} |