发表于: 2018-01-28 21:42:17
1 604
今日完成
1.看了一下tuscany的官方文档,真的和说的一样,参考的资料很少。
(1)导入jar包
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-base-runtime</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-implementation-spring-runtime</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-binding-rmi-runtime</artifactId>
<version>2.0.1</version>
<!--<scope>runtime</scope>-->
</dependency>
(2)配置接口——直接和spring整合,不写demo了。
service端
<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
name="StuService" targetNamespace="http://StuService">
<component name="StuComponent">
<implementation.spring location="spring-tuscany.xml"/>
<service name="StuService1">
<tuscany:binding.rmi uri="https://127.0.0.1:8088/StuService1"/>
</service>
</component>
</composite>
<?xml version= "1.0" encoding ="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:sca="http://www.springframework.org/schema/sca"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/sca
http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd" >
<sca:service name="StuService1" type="com.jnshu.service.StudentService" target="StuService"/>
<bean id="StuService" name="StuServcie" "com.jnshu.impl.StudentServiceImpl"/>
<import resource="spring-mybatis.xml"/>
</beans>
用main方法执行下面代码发布服务
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-tuscany.xml");
Node node = NodeFactory.newInstance().createNode("Calculator.composite");
node.start();
System.out.println("service启动");
没有成功,好像问题还蛮多。
2.继续学习集合的基础知识。map
1. HashMap概述
Java中的数据存储方式有两种结构,一种是数组,另一种就是链表,前者的特点是连续空间,寻址迅速,但是在增删元素的时候会有较大幅度的移动,所以数组的特点是查询速度快,增删较慢。
而链表由于空间不连续,寻址困难,增删元素只需修改指针,所以链表的特点是查询速度慢、增删快。
那么有没有一种数据结构来综合一下数组和链表以便发挥他们各自的优势?答案就是哈希表。哈希表的存储结构如下图所示:
我们可以发现哈希表是由数组+链表组成的,一个长度为16的数组中,每个元素存储的是一个链表的头结点,通过功能类似于hash(key.hashCode())%len的操作,获得要添加的元素所要存放的的数组位置。
HashMap的哈希算法实际操作是通过位运算,比取模运算效率更高,同样能达到使其分布均匀的目的
(2)Map和Collection的区别?
A:Map 存储的是键值对形式的元素,键唯一,值可以重复。夫妻对
B:Collection 存储的是单独出现的元素,子接口Set元素唯一,子接口List元素可重复。光棍
Map接口和Collection接口的不同
Map是双列的,Collection是单列的
Map的键唯一,Collection的子体系Set是唯一的
Map集合的数据结构值针对键有效,跟值无关
Collection集合的数据结构是针对元素有效
(3)HashMap和Hashtable的区别
(1)HashMap是非线程安全的,HashTable是线程安全的。
(2)HashMap的键和值都允许有null存在,而HashTable则都不行。
(3)因为线程安全、哈希效率的问题,HashMap效率比HashTable的要高。
明日计划
1,spring 和 tuscany的整合,希望可以跑通。
遇到问题
1.tuscany的参考资料太少。
收获
1.map的学习
2.tuscany的了解。
评论